This library provides a standard RegEx interface (mirroring the JavaScript API) and attempts to call out to native RegEx APIs if provided by the Lua runtime. If no native RegEx API is provided, it will fall back to an in-Lua RegEx implementation.
The API mirrors JavaScript (docs for which can be found here).
local RegEx = require(...)
-- NOTE: The multi-line string syntax is required to support the `\` syntax!
local myRe = RegEx.new([[/d(b+)d/]], "g");
local myArray = myRe:exec("cdbbdbsbz");
The following table shows which JavaScript RegExp features are supported in each runtime. If you require a specific RegEx feature and it is not supported then please submit and issue or make a pull request!
Runtime | exec() |
test() |
match() |
matchAll() |
search() |
replace() |
replaceAll() |
split() |
---|---|---|---|---|---|---|---|---|
Fallback | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |