Thread: Regex examples
View Single Post
Old 06-22-2012, 07:48 PM   #88
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 8,989
Karma: 40810464
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by soulafein View Post
Hi! I'm looking for an expression that erase "- " but not " - ".
(example: sim- ple, not: word - word).
Could somebody help me??
There's no real way of knowing that only complete words are on either side of the hyphen, but strictly in keeping with what you asked...

Find: (?<!\s)-\s Or: \w\K-\s
Replace: <empty/blank>

Please test first, and do keep in mind that there's many situations in normal written text where what you're looking for will (and should) occur. I certainly wouldn't suggest using "Replace all" but it may help you narrow down the occurrences enough where you can sign off on each and every replacement.

Last edited by DiapDealer; 06-22-2012 at 08:45 PM.
DiapDealer is online now   Reply With Quote