I wasn't able to answer this instantly.
I did find that this helps:
note the added parens.perl -debug DB<1> $string= "...foo\nbar..."; DB<2> x $string =~ /(foo$bar)/m; DB<3> x $string =~ /(foo$^bar)/m; DB<4> x $string =~ /( foo$ ^bar )/mx;
You may also want to add use strict and turn on warnings (though those don't work very well when using the debugger like above). You may also be interested in seeing how backslashes change things. |
In reply to (tye)Re: (Regex Quiz) Multi-line Matching
by tye
in thread (Regex Quiz) Multi-line Matching
by japhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |