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

Fix regexp handling #2

Closed
Trott opened this issue Oct 30, 2018 · 3 comments
Closed

Fix regexp handling #2

Trott opened this issue Oct 30, 2018 · 3 comments

Comments

@Trott
Copy link
Owner

Trott commented Oct 30, 2018

Right now, if no strings in the configuration contain regexp-y things, they will happily be processed as a regular expression. I can't decide if this is a feature or a bug.

If a feature, then the issue is that the output will contain the regexp-y things, like:

Use "Node.js" instead of "Node\b"

That \b is a zero-width word-boundary. Not terribly friendly output. (By the way, the config requires that the backslash be escaped so it will look like no: 'Node\\b'.)

If a bug, then we should find a way to disable it and enable a more explicit "this is a regexp" way of doing things. Also, make sure the regexp-way-of-doing-things has a decent error message for output.

@armano2
Copy link

armano2 commented Nov 18, 2018

i got interested by this, and looks like you can input any type of regexp

new RegExp(`(\\.|@[a-z0-9/-]*)?${val.no}(\\.\\w)?`, 'g');

but there is also side effect here, if you input dot it will means any character

@Trott
Copy link
Owner Author

Trott commented Mar 18, 2019

Easiest solution here might be to get rid of the "instead of" part of the message? "Use foo" rather than "Use foo instead of F00" and trust that the user will be able to find the prohibited string?

@Trott
Copy link
Owner Author

Trott commented Mar 18, 2019

Slightly more robust solution would be to make the entirety of the thing a capture group and output whatever the match is?

@Trott Trott closed this as completed in 42fa5ba Mar 18, 2019
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