vasanth.easyrider has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Monks
i have a perl script
#!/usr/bin/perl use strict; use warnings; my $output = "ae4.5784 up down inet 182.75.123.121/30"; if($output =~ m/(\d{1,3}\.\d{1-3}\.\d{1-3}\.\d{1-3})$/g) { print "There is an IPdressAd in the output string\n"; } else { print "There is no IPAddress in the output string"; }
My requirement is to check if $output has an IPaddress in it or not. In above example - it contains an IP.
how to give the correct regular expression . The regular expression i have given is not working
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IPAddress check (updated)
by haukex (Archbishop) on Mar 13, 2018 at 11:46 UTC | |
|
Re: IPAddress check
by thanos1983 (Parson) on Mar 13, 2018 at 11:48 UTC | |
by AnomalousMonk (Archbishop) on Mar 13, 2018 at 13:53 UTC | |
by thanos1983 (Parson) on Mar 13, 2018 at 14:45 UTC |