in reply to Re: Regex to ignore comment
in thread Regex to ignore comment

I need to get the text before the comment IE # invalid

__DATA__ [IP] regex = (?<First>..... pattern = 255.257.0.0 # invalid pattern = 192.168.1.1

Replies are listed 'Best First'.
Re^3: Regex to ignore comment
by Corion (Patriarch) on Oct 20, 2015 at 18:03 UTC

    Why don't you just strip off everything starting with #?

    $line =~ s!#.*$!!; # strip off comments my( $key, $value ) = split /=/, $line;