in reply to Re^2: Regex in a printfile?
in thread Regex in a printfile?
my @fred = (1, 2, 3, 4, 5); my $lastSub = $#fred; print qq{$lastSub\n};
running your substitution will result in
my @fred = (1, 2, 3, 4, 5); my $lastSub = $ print qq{$lastSub\n};
Perhaps something like
s{(?<!\$)#.*$}{};
would be better but there may be other syntax where the hash is not the start of a comment that I haven't thought of.
Cheers,
JohnGG
Update: Found another non-comment occurrence of the # character in the colour values in Tk programs, e.g.
-background => #101010,
so perhaps now
s{(?<!\$)#(?![0-9a-fA-F]{6}).*$}{};
|
|---|