Thread: Regex examples
View Single Post
Old 03-06-2013, 05:20 AM   #208
mzmm
Groupie
mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.mzmm has not lost his or her sense of wonder.
 
mzmm's Avatar
 
Posts: 161
Karma: 86115
Join Date: Feb 2012
Device: iPad, Kindle Touch, Sony PRS-T1
Quote:
Originally Posted by Ripplinger View Post
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.
this should work.

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

\1“\2\3\4
mzmm is offline   Reply With Quote