in reply to Re^2: Regex Tool
in thread Regex Tool
Just for your interest:
Multiple ^ or $ anchors would be legal.
The /m modifier in combination with the /s modifier would match the intended behaviour.
/m: match over multiple lines
/s: . matches everything (even newlines)
Note that you would have to insert code to match any newline either by . or by \s. See example below.
my $text = <<"END"; a sample line item duhduh foo END $text =~ /^item.*(^duhduh$)\s*foo$/sm; print "\$1: '$1'\n"; # prints "$1: 'duhduh'"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Regex Tool
by a (Friar) on Jul 01, 2006 at 14:22 UTC |
In Section
Cool Uses for Perl