On 11/28/06, flw <[EMAIL PROTECTED]> wrote:
Who cabeginnersn help me to explain the reason?
$ perl -e '$_="a11\nb22\nc33\n"; print $_, "-"x15, "\n";s/^a.*^b.*/x/m; print'
The problem here is that \m allows "^" to match after any newline
within the string, but does not change "." which matches any character
(except newline). The following can do what you want -- not pretty,
but works
$ perl -e '$_="a11\nb22\nc33\n"; print $_, "-"x15,
"\n";s/^a(.|\n)*^b.*/x/m; print'
a11
b22
c33
---------------
x
c33
You may read about it in 'perldoc perlre' in the first four paragraphs
of the section "Regular Expressions" (perl 5.8.8).
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>