Given your example, if you are trying to do substitutions on all the lines which match all the 2-numbered lines, just ignore the "not parts" ...
$line =~ s/(pattern1).+?pattern2.+?\1/substitute/;
... Above will work since "pattern2" does not appear (per your example) in any lines identified by the 1s, so they remain unchanged.
In reply to Re: How can I build regexp with "not" assertion?
by parv
in thread How can I build regexp with "not" assertion?
by putnik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |