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

Use \ for Fluent.match(char) and Fluent.match(String) #14

Open
numeralnathan opened this issue Jul 17, 2021 · 0 comments
Open

Use \ for Fluent.match(char) and Fluent.match(String) #14

numeralnathan opened this issue Jul 17, 2021 · 0 comments

Comments

@numeralnathan
Copy link

numeralnathan commented Jul 17, 2021

Currently, Fluent.match(char) will take the character (e.g. $) and wrap it with \Q and \E (e.g. \Q$\E). This is harder to read than \ (e.g. \$). Please make Fluent.match(char) smart in that it will add \ only when necessary.

Furthermore, please make Fluent.match(String) smart in that it will add \ for each character that needs it and if there are 5 or more characters in sequence that need escaping then use \Q and \E. Why 5 or more? To minimize the total length of the regular expression. Adding \Q and \E adds 4 characters. If there are 4 or less characters needing escaping, then adding 4 or less \ will be easier to read.

This will make it easier for humans to read the regular expression.

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