Quote:
Originally Posted by DiapDealer
The question mark can be a tricky bugger. When used after a character (or character class or grouping), it essentially makes what precedes it optional (technically it's a repetition operator meaning repeat the preceding 0, or 1 times).
When used after another repetition character like + or * its effect is to make that repetition character lazy instead of its default greedy: meaning match as little as possible.
... (?U) means turn on ungreedy mode. Which reverses the greediness/laziness of ALL repetition quantifiers. (?U)a* is lazy and (?U)a*? is greedy. In Sigil, including (?U) will also reverse the effect of checking the Minimal Match box.
So in your examples:
(?U)<h2([^>]*>.*)</h2>
Would be the same as:
<h2([^>]*?>.*?)</h2>
In this particular case, <h2([^>]*?> is essentially the same as <h2([^>]*> since the negated character-class [^>] prevents the * repetition character from extending beyond the the next '>' anyway.
(?s) is essentially the same as ticking the dotAll box in sigil. It treats everything as a single line because the dot character will match everything (including newline characters). It's opposite is (?m). These affect the special ^ and $ characters.
|
This is awesome!

so much!
Funny you should mention that site as I am a regular visitor there. However, it often confuses me. I think it's written for people who have more understanding than I have