Skip to content

Support regex literals as functions #147

@tommy

Description

@tommy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions