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 #3415

Closed
Tracked by #3293
pbiggar opened this issue Jan 31, 2022 · 2 comments
Closed
Tracked by #3293

Support Regex #3415

pbiggar opened this issue Jan 31, 2022 · 2 comments

Comments

@pbiggar
Copy link
Member

pbiggar commented Jan 31, 2022

Users often ask for regex.

Dark v1 does not have regex, due to the technical challenge that the OCaml native regex implementation we used (re2) does not compile to JS.

We want to use a regex implementation which can not be DOSed. Parse.com apparently had big problems with their regex.

Need a good API for this - regex libraries often have APIs that make them very hard to use

I've never seen a regex implementation that was as easy to use as Perl's, so that's what we're aiming for (in terms of simplicity, not necessarily syntax):

# does it match?
if ($str =~ /ul/) { ... }

# capturing
if($line =~ /name:\s+(\w+\s+\w+),\s+period:\s*(\d{4}\-\d{4})/)
  $composers{$1} = $2;

I'd love to have editor plugins showing users the state machine for their regex, or helping them write better ones.

@pbiggar pbiggar changed the title Regex Support Regex Jan 31, 2022
@pbiggar
Copy link
Member Author

pbiggar commented May 26, 2022

Steps:

  • design regex API
  • add regex implementation
    • short timeout
    • perhaps no backtracking
    • ensure it works in Wasm
  • add way of showing the state machine in the UI

@StachuDotNet
Copy link
Member

This is great - currently folding into #5243, but will revisit when the time comes

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

2 participants