http://www.perlmonks.org?node_id=981399


in reply to Re^2: regex needed
in thread regex needed

It may help to talk it through in words first. The pattern you're looking at is:

Now just put those elements together in a regex:

if( $line =~ m[ \$\$ # two dollar signs \( # open paren ([^)]+) # capture until closed paren \) # close paren (.*) # capture the rest, if any ]x ){ # do stuff with $1 and $2 }

Aaron B.
Available for small or large Perl jobs; see my home node.