Hello!
sregex 本身是一个 C 库,提供了 C API,你可以直接使用 LuaJIT 的 FFI 调用任意的 C API:
http://luajit.org/ext_ffi_tutorial.html
更复杂一些的实例可以参考 lua-resty-string 库和 lua-resty-core 库:
https://github.com/agentzh/lua-resty-string
https://github.com/agentzh/lua-resty-core
关于 sregex 本身的 C API 的用法,可以参考 ngx_replace_filter 模块的实现:
https://github.com/agentzh/replace-filter-nginx-module
Regards,
-agentzh