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

default value of regex option is both true and false #101

Open
mojavelinux opened this issue Dec 15, 2021 · 1 comment
Open

default value of regex option is both true and false #101

mojavelinux opened this issue Dec 15, 2021 · 1 comment

Comments

@mojavelinux
Copy link
Contributor

If the regex option is not specified, the value is treated as true in some scenarios and false in others. Only by setting the option explicitly do you get consistent behavior.

Here's a case where the regex option defaults to true:

(a|b|c)+
//=> /^(?:(a|b|c)+)$/

Here's case where the regex option defaults to false:

(a|b|c)*
//=> /^(?:(a|b|c)[^/]*?\/?)$/

I'm willing to contribute a PR to address this inconsistency.

@mojavelinux
Copy link
Contributor Author

This inconsistency seems to have lived long enough that a lot of tests depend on it one way or another. One possibility is to simply document that the default value is auto selected based on the context. Please let me know how you would like to proceed. If it comes down to a documentation issue, I can accept that outcome.

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