|Perl: the Markov chain saw|
Re^4: Regex Toolby a (Friar)
|on Jul 01, 2006 at 14:22 UTC||Need Help??|
Just a point here - something I finally got only after a number of rereadings of the section in J. Friedl's excellent Mastering Regular Expressions (O'Reilly) the /m and /s are a little more complicated.
/m: better remembered as 'multi' mode - affects 'multiple' (2) meta chars, the anchors (^ and $)
/s: 'single' mode - affects one meta char, the dot '.'
/s changes the dot's normal definition - match any char except a new line (\n).
In single mode the dot can match \n too which allows regex phrases like:
to match across the end of line. That all it does and so its why the "item.*" in your example matches the end of line.
Not a useful snippet but ... two notes - the '\n' on the print stmt and notice the diff if you put an 's' in the match options