Thread: Regex examples
View Single Post
Old 07-26-2017, 03:53 AM   #529
Steadyhands
Connoisseur
Steadyhands began at the beginning.
 
Steadyhands's Avatar
 
Posts: 57
Karma: 10
Join Date: Dec 2011
Device: Samsung Tablet
Here a regex I find useful for finding & correcting contractions that have spaces in them. Don't blast this with a replace all as it does match false positives where a word has been shortened to only a single letter.

Target text.
Quote:
don‘ t
wasn ’t
Couldn’ t
I ‘m
False positive
Quote:
Th’ lads ’re all
An’ let ’m
what ’m I going to do
Code:
Search \b(\s(‘|’)|(‘|’)\s)(d|m|s|t|ll|re|ve)\b(?!’)
Replace ’\4
Steadyhands is offline   Reply With Quote