View Single Post
Old 01-26-2012, 08:10 PM   #1
ElMiko
Evangelist
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 455
Karma: 65460
Join Date: Jun 2011
Device: Kindle
restricting regex to single lines of code?

Not too long ago I asked a question about how do the opposite of this. Naturally now I need to now how to do the opposite of that...

I'm currently working on a document in which all double-quotations marks have been replaced with a question mark. Obviously, I'm trying to undo that. The way i had planned on doing that is by search for strings that begin with ? and end with two consecutive punctuation marks, the latter of which also being ? (i.e., .? or !? or ,? or ??).
The search I was using was:
Code:
\?([^\.]*)\.\?
I was then going to do subsequent searches with different punctuation marks in between the brackets. Unfortunately, I never got that far because the above search was being too greedy.

example:
Code:
  <p>?Or the television reports??</p>

  <p>?No.?</p>
for the above text, the search matches "??</p> <p>?No.?" instead of just "?No.?"

How do I do this right? (PS - using "<" as a marker won't work because not all dialogue finishes at the end of a paragraph ---> eg. <p>"Let's get out of here!" he yelled.</p>)

Last edited by ElMiko; 01-28-2012 at 12:18 AM.
ElMiko is offline   Reply With Quote