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

Support regex literals as functions #147

Open
tommy opened this issue Nov 23, 2024 · 0 comments
Open

Support regex literals as functions #147

tommy opened this issue Nov 23, 2024 · 0 comments

Comments

@tommy
Copy link
Contributor

tommy commented Nov 23, 2024

Regex literals can be used in places where functions or lambdas can be used. For example:

"123" ~> /([0-9]+)/ 

evaluates to

{
  "match": "123",
  "start": 0,
  "end": 3,
  "groups": [
    "123"
  ],
  "next": "<native function>#0"
}

Where the result of invoking the .next() function of this object returns the next match in the input string. This is similar to a lazy version of the $match function.

See: https://docs.jsonata.org/regex#generic-matchers

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

No branches or pull requests

1 participant