I have this simple code
perl -we 'my $file= "
# parameter=10
# parameter=10
# parameter=10
parameter=10
parameter=10
"; $file=~ s/((?<!# ))\s*parameter\s*=.*/parameter=replaced/g; print(":$file:\n")'
and I want it to replace all parameter=10 but not if it is preceeded by a hash anywhere on that line. e.g.
# parameter=10
# parameter=10
# parameter=10
parameter=replaced
parameter=replaced
i know that if I provide a
((?<!#\s*))
I get an error
Variable length lookbehind not implemented in regex
So is there a way to do the task by any other means?
Thanks
\K- regular-expressions.info/keep.html