in reply to how to write a multi-line regex
You may want to take a look at perlre and perlretut. I usually pick something such as below (admittedly picked it up from Perl Best Practices by Damian Conway). I like to use the 'xms' modifiers:
my $line = qr{ \A # Start of string \s* # Leading blanks \w+ # Key \s* \w+ # Value \s* # Trailing blanks \z # End of string }xms;
Alternatively, I use Regexp::Common as well if I want to build something up from components. It's not really what you were asking, but it may be handy.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: how to write a multi-line regex
by zerocred (Beadle) on Jan 22, 2010 at 08:06 UTC | |
by johngg (Canon) on Jan 22, 2010 at 11:55 UTC | |
by zerocred (Beadle) on Jan 25, 2010 at 14:12 UTC |
In Section
Seekers of Perl Wisdom