Thread: Regex examples
View Single Post
Old 04-24-2014, 05:38 PM   #343
Steadyhands
Connoisseur
Steadyhands began at the beginning.
 
Steadyhands's Avatar
 
Posts: 57
Karma: 10
Join Date: Dec 2011
Device: Samsung Tablet
I'm looking to fix incorrect apostrophes at beginning of contracted words, but not match closed single smart quotes. If it was always a space after it would be easy but if the contraction is at the end of the sentence then ...

FYI - In the file speech is in double smart quotes. Not going to attempt a global S&R but just a step through.

Find this
‘em ‘bout ‘im

Not this
‘foo’ ‘bar’ ‘not this’ ‘or this,’ ‘this,’


I've been playing with variation of this
Quote:
‘([^’]*?)([\.\,\;\:\?\!|\s])
Edit - still playing with ideas
this works better - negative lookahead
Quote:
(?!‘([a-z]* [a-z]*|[a-z]*|[a-z]* [a-z]*\p{P}|[a-z]*\p{P})’)‘

Last edited by Steadyhands; 04-25-2014 at 02:16 AM.
Steadyhands is offline   Reply With Quote