[Resolves #91] Invalid characters on suffix #92
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the change
On the conversion of the user input, instead of blindly generating the regex for matching based on the configured
positive
value we ensure that the value for positive is escaped if needed, by invoking Regexp.escape.Why are we doing this?
Building the regex blindly based on the user suffix param, in case he/she uses characters that conflict with the regex definition itself, it makes the prompt crash.
Benefits
When adding this, the suffix option for the prompt will support characters that otherwise would crash the regex definition.
Drawbacks
None that I can think of
Requirements
Put an X between brackets on each line if you have done the item:
[x] Tests written & passing locally?
[x] Code style checked?
Tried to follow the patterns I've identified in the existing codebase but i might have missed something.
[x] Rebased with
master
branch?[] Documentaion updated?
There is no need for updated documentation in my opinion