fixed word boundary by using \b instead ([\W\s]?) and add RegEx support#1
Open
RobKehl wants to merge 2 commits into
Open
fixed word boundary by using \b instead ([\W\s]?) and add RegEx support#1RobKehl wants to merge 2 commits into
RobKehl wants to merge 2 commits into
Conversation
Author
|
The second change is about adding RegEx support. The admin is now able to use a regular expression in 'Match' and the eventually corresponding backreferences in 'Replace'. That would allow this sort of match/replace-Bombshells to replace telephone numbers with tel:-links automagically:
s/((+|00)?([0-9]{2}-?)?[0-9]{3,5}( +)?(-|\/)( +)?[0-9]+)/${1}/i
For sure there are other things one could do with REs in this plugin, and the user is able to choose between REs and plain text. I thought it could be a valuable addition. I submit it in chain to the former pull request, because it depends on it: The use of \1 and \2 in your original code would render the backreferences in 'Replace' invalid, and my change 8c11d19 makes those not necessary anymore and thus frees the way to using REs. Cheers, Rob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi Jonathon!
First of, let me thank you for your plugin, it just works, which is great.
In this pull request I offer a fix for the problem where a token does not get replaced when it is at the end of the title. By using \b instead of ([\W\s]?), replacing works.
Cheers,
Rob