Thread: Regex examples
View Single Post
Old 03-05-2013, 02:02 PM   #201
Ripplinger
350 Hoarder
Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.Ripplinger ought to be getting tired of karma fortunes by now.
 
Ripplinger's Avatar
 
Posts: 3,574
Karma: 8281267
Join Date: Dec 2010
Location: Midwest USA
Device: Sony PRS-350, Kobo Glo & Glo HD, PW2
Quote:
Originally Posted by mzmm View Post
try this? it'll probably still miss some (like if the closing quote butts up against a </span> instead of a </p> for example) so you'd probably want to scan the text afterwards but it might save you some copy/pasting.

Code:
find: (<p[^>]*>)(?:\s+)?([^“]+?”)(?:\s+)?(</p>)

replace: \1“\2\3
That's getting closer and it will pick up more, but it won't work on a sentence where the end quote isn't directly before the </p>, so it wouldn't pick up this sentence if the beginning quote was missing:

“But how would you deal with these miseries out of the past?” I asked.

Even if there were 2 regex strings to run to be able to pick up both sentence structures would still be much better than just hoping you find them all in proofing.
Ripplinger is offline   Reply With Quote