[Chicago-talk] Perl Style
frag at ripco.com
Wed Aug 18 22:54:38 CDT 2004
On Wed, 18 Aug 2004 Andy_Bach at wiwb.uscourts.gov wrote:
> Now, from the Owl book (Friedl "Mastering Regular Expressions"), I've
> learned the /s can be called 'single mode' in that it affects a single
> RE metachar, to wit the '.' With "/s" the '.' will match the \n char.
> That's it. The "/m" can be called "multi mode" in that it affects 2
> (aka "multiple") RE metachars, the caret and dollar sign. In "/m" they
> match on either side of a normal 'line' (the $/ (er, $\?) char, normally
> \n) so that in a /g situation, for example, they'll match more than once
> if you have multi-line input. In the "/m" case \A and \Z can be used to
> match the absolute string begin/string end - otherwise "^" is the same
> as "\A" and "$" is the same as "\Z"
> I inject this here, only because its taken many, many rereads of that
> section and I still have the sinking feeling I've not got it right yet.
> I'm closer, maybe but ...
That looks basically right to me, except you left out \z vs. \Z.
-- Mike F.
More information about the Chicago-talk