Rainie3535 / sigil

Automatically exported from code.google.com/p/sigil
GNU General Public License v3.0
0 stars 0 forks source link

Option for regex . character to match newlines #1160

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The old search and replace matched newlines with the . character.  This is 
useful if for example you want to remove a tag that spans several lines, like a 
<style> tag.  Before I could do something like <style.*<\/style> to match every 
style block.  This no longer works because . no longer matches newlines.

Original issue reported on code.google.com by alexande...@gmail.com on 9 Jan 2012 at 5:26

GoogleCodeExporter commented 9 years ago
With PCRE regex need to put (?s) in your pattern to tell regex to span lines, 
preferably at the start, e.g. (?s)<style.*<\/style>

But that will match everything from the first style to the last because its 
greedy.  You also need to turn on minimal/non-greedy matching with ? after your 
pattern, e.g. (?s)<style.*?<\/style>

Original comment by meme90...@gmail.com on 9 Jan 2012 at 8:05

GoogleCodeExporter commented 9 years ago

Original comment by john@nachtimwald.com on 9 Jan 2012 at 12:48