In the spirit of TIMTOWTDI, here's yet another method to handle this, one that I have often used with complex situations. The code might look something like this (untested).
my $replace = sub { my $prefix = $1; #COLLECT YOUR PAIRS SOMEHOW; A m// OR s/// ALSO POSSIBLE my @pairs = split(/(.*?[=].*?)(?:[,])?/, $prefix); #DEAL WITH PAIRS HOWEVER YOU LIKE push @allpairs, @pairs; #RETURN WHATEVER REPLACEMENT YOU LIKE FOR $prefix return $prefix; #NO CHANGE AT ALL }; #CAPTURE EVERYTHING UP TO, NOT INCLUDING, "batch =" $syspbuff =~ s/(.*?)(?=batch\s*=)/$replace->()/em;
Blessings,
~Polyglot~
In reply to Re: Unable to constrain the effect of a negative lookahead
by Polyglot
in thread Unable to constrain the effect of a negative lookahead
by fireblood
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |