in reply to Re: Regex to ignore comment
in thread Regex to ignore comment
I don't want to do the regex $line =~ s/\s*#.*$//; becuse it might be in the pattern. such as
pattern = the number is #8 # number
where #8 is in the pattern
and # number is a comment
I was hoping that i could do a look behind and catch it that way.
But corion's way of doing this is really the same thing.
$line =~ s!#.*$!!; # strip off comments my( $key, $value ) = split /=/, $line;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Regex to ignore comment
by AppleFritter (Vicar) on Oct 20, 2015 at 20:19 UTC | |
Re^3: Regex to ignore comment
by Laurent_R (Canon) on Oct 20, 2015 at 20:17 UTC | |
Re^3: Regex to ignore comment
by Corion (Patriarch) on Oct 20, 2015 at 20:18 UTC |