-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a regular expression library #265
Conversation
Thanks for the PR, a regex module is going to be super useful 👍 A couple of changes I'd like to make before landing this:
I can take care of moving this forward so don't worry about making changes (unless you feel like it), although it won't be until after the weekend. |
Thanks for your comments. Here are my thoughts:
|
Hi @jasal82, just pinging to say I haven't forgotten about this PR, and I'll get around to it as soon as I can. |
42f8945
to
cc1f029
Compare
@jasal82 I've updated the regex lib now to the point where I'd be happy to land it, if you have a moment could you take a look at the API changes I made? No problem if you don't have time, we can always revisit it later if you have notes. |
The Captures interface was emulating a hash map, so it probably makes sense to just return a regular KMap.
This adds basic regular expression functionality to Koto. It uses the
regex
crate and mimics its interface as far as possible. The following operations are supported:is_match
find
find_all
(iterable)captures
(index and named)replace_all
I tried to reuse the original
Match
object but it didn't work out due to lifetime issues, so I replaced it with my own representation. Maybe there is an easier way, feel free to change.