Expose a native RegEx API
Closed this issue ยท 3 comments
Created this issue for the sake of record keeping and further discussion, but this was already very briefly discussed in the Roblox OSS Discord.
There are very few RegEx implementations written in Lua, and the ones that do exist are slow and don't have full feature coverage. Rust already has a performant and feature-complete RegEx implementation, and it just needs to be exposed in a Lua API.
Questions:
- Should the RegEx API be exposed as a global (JavaScript style, with
RegEx.new("...")
) or via a require (local regex = require("@lune/regex")
)?
cc @matthargett
For how it should be exposed I think we should do require("@lune/regex")
, all of the other builtins will be moving to this syntax by the 0.7
release, once we have IDE support for it too
That said, the regex library is something we depend on for other stuff and is part of the size of the final lune binary already, so the only thing missing is making the wrapper ๐
This has now (finally) been implemented, courtesy of @Dekkonot!
There is still a bit of documentation and test coverage to do, but @lune/regex
will be in the next release, and anyone who wants to use it right away can check out the latest commit / main branch.
cc @grilme99 @jeparlaisfrancais , in case they weren't already aware, this may or may not "just work" with jest. Worth running the test suite.