Thread
:
Help with regex for adding in a hyphen
View Single Post
08-06-2020, 08:48 AM
#
2
davidfor
Grand Sorcerer
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
The search for the first one would be:
Code:
(\w+)(.*)
The second would be:
Code:
(\w+ \w+)(.*)
With replacement:
Code:
\1 - \2
With whatever punctuation you want in there.
The above assumes the first word doesn't have a hyphen or apostrophe or some non-letter/number character.
davidfor
View Public Profile
Find More Posts by davidfor
Track Posts by davidfor via RSS