in reply to Re: Regex match multiple line output
in thread Regex match multiple line output

Damn... back to the reading books... Thank you.

Replies are listed 'Best First'.
Re^3: Regex match multiple line output
by AnomalousMonk (Archbishop) on Feb 20, 2018 at 17:07 UTC

    bartrad: You are well advised to use Regexp::Common::net for IP matching, but be aware that by design, these regexes are not "bounded" or "delimited"; used as-is, they may match things you don't consider a proper IP and you may need to define your own regex. In the case of the  $RE{net}{IPv4} dotted-decimal IP matcher, consider:

    c:\@Work\Perl\monks>perl -wMstrict -le "use Regexp::Common qw(net); ;; my $s = '123456.4.32.123456'; ;; print qq{A: match, captured '$1'} if $s =~ m{ ($RE{net}{IPv4}) }xms; ;; my $my_ip = qr{ \b $RE{net}{IPv4} \b }xms; print qq{B: match, captured '$1'} if $s =~ m{ ($my_ip) }xms; " A: match, captured '56.4.32.123'


    Give a man a fish:  <%-{-{-{-<