Skip to content
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 regexp module #103

Merged
merged 2 commits into from
Sep 18, 2023
Merged

Add regexp module #103

merged 2 commits into from
Sep 18, 2023

Conversation

myzie
Copy link
Collaborator

@myzie myzie commented Sep 18, 2023

Adds support for regular expressions:

  • New object.Regexp Risor type that wraps *regexp.Regexp.
  • New regexp module

The regexp module object is callable, so regexp("foo") returns a compiled Regexp object.

go run ./cmd/risor
Risor

>>> r := regexp("foo.?")
>>> r
regexp("foo.?")
>>> r.match("food")
true
>>> r.match("fo")
false

@myzie myzie merged commit 0719c97 into main Sep 18, 2023
2 checks passed
@myzie myzie deleted the regexp branch September 18, 2023 12:56
@@ -0,0 +1,50 @@
package rand
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package regexp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants