Don't ask to ask, just ask | |
PerlMonks |
in reply to Matching a string in a parenthesized block (regex help)
If both is true use the flip-flop operator .. to match start and end of a block.
Use a normal regex to match the insides.
if( /block-start/ .. /block-end/ ) { $block .= $line; $hit = 1 if /match-plz/; } else { print $block if $hit; $block = $hit = undef; # reset }
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Matching a string in a parenthesized block (regex help)
by maxamillionk (Acolyte) on Mar 06, 2021 at 14:23 UTC | |
by LanX (Saint) on Mar 06, 2021 at 15:43 UTC |