Skip to content

fixed word boundary by using \b instead ([\W\s]?) and add RegEx support#1

Open
RobKehl wants to merge 2 commits into
confuzzledduck:masterfrom
RobKehl:master
Open

fixed word boundary by using \b instead ([\W\s]?) and add RegEx support#1
RobKehl wants to merge 2 commits into
confuzzledduck:masterfrom
RobKehl:master

Conversation

@RobKehl

@RobKehl RobKehl commented Mar 21, 2015

Copy link
Copy Markdown

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

@RobKehl

RobKehl commented Mar 22, 2015

Copy link
Copy Markdown
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

@RobKehl RobKehl changed the title fixed word boundary by using \b instead ([\W\s]?) fixed word boundary by using \b instead ([\W\s]?) nad add RegEx support Mar 22, 2015
@RobKehl RobKehl changed the title fixed word boundary by using \b instead ([\W\s]?) nad add RegEx support fixed word boundary by using \b instead ([\W\s]?) and add RegEx support Mar 22, 2015
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

Successfully merging this pull request may close these issues.

1 participant