View Single Post
Old 03-20-2011, 12:56 PM   #9
DMSmillie
Enquiring Mind
DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'DMSmillie understands when you whisper 'The dog barks at midnight.'
 
DMSmillie's Avatar
 
Posts: 562
Karma: 42350
Join Date: Aug 2010
Location: London, UK
Device: Kindle 3 (WiFi)
Quote:
Originally Posted by Perkin View Post
Use code view, In replace, select more, tick regular expression, tick minimal matching

search for
_(.+?)_

repace with
<i>\1</i>
Quote:
Originally Posted by seagull View Post
Didn't work but thanks anyway.
This had me puzzled, as I'd likely have suggested the same regex, so I checked Sigil's user manual and found this:

"Non-greedy matching cannot be applied to individual quantifiers. Expressions like abc*?dd are not allowed. Use the Minimal matching option to set minimal matching on the whole expression."

So I tried the regex without the "?":

_(.+)_

- and with "Minimal matching" selected, and it worked fine. It was the "?" that was throwing Sigil's regex engine. Worth knowing for future reference.

Edit: Heh! st_albert beat me to it while I was typing, in fewer words and with an explanation.
DMSmillie is offline   Reply With Quote