Well let me see if I can shed some light.
The first bit is obviously just assigning $1 to $ret if the pattern matches. That's the easy part. Now let's look at the pattern.$ret = $1 if $g =~ /\n\s*\n((?m:^#.*\n)+)$id/;
Very well done. sauoq++/\n\s*\n # This matches your blank line between comments. ( # Capture into $1. (?m: # Don't capture, but match this group as multiline. Wh +ich means match '^' and '$' # at the beginning or end of any line in the string. ^# # Match the comment delimiter at the start of a line. .*\n # Match everything up to, and including, the newline a +t the end of a line. )+ # Match this group one or more times. ) # End of $1 capture. $id # This is the key you're looking for. /x
kelan
Yak it up with Fullscreen ChatBox
In reply to Re: Re: Re: multi-line regex match quest
by kelan
in thread multi-line regex match quest
by smackdab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |