Tom Phoenix wrote:
> On 8/5/06, Peter Daum <[EMAIL PROTECTED]> wrote:

>> $s =~ /^(.*[^\\])(\\)?$/; print "1: '$1', 2: '$2'";
> 
> Let's see what that pattern matches by annotating it:
> 
>  m{
>    ^       # start of string
>    (       # memory 1
>      .*    # any ol' junk, including backslashes
>      [^\\] # any non-backslash, including newlines

... aaaaaaaah ;-)

I somehow had always assumed, that not only "."
but also other constructs (like the [^\\] which really
was intended as [^\\\n]) treat the newline special and
only "\n" or "$" match the newline - certainly not
something the Perl documentation says anywhere,
but this was the first time I ever had a situation
where this makes a difference.

Thanks a lot for the explanation!

Regards,
                Peter Daum


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to