goldgriff has asked for the wisdom of the Perl Monks concerning the following question:
I am matching an ip address within a string. I am using a regex from this site, and I am getting mixed results.
Regex =
m/([01]?\d\d?|2[0-4]\d|25[0-5]) \. ([01]?\d\d?|2[0-4]\d|25[0-5]) \. ([01]?\d\d?|2[0-4]\d|25[0-5]) \. ([01]?\d\d?|2[0-4]\d|25[0-5])(.*)/x
Text --------------------> Results
'23.165.2.40' '23.165.2.40' '(23.165.2.40)' '23.165.2.40' '[23.165.2.40]' '23.165.2.4' '{23.165.2.40}' '23.165.2.4'
Thanks in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IP Number Regex
by schumi (Hermit) on Jul 23, 2001 at 01:24 UTC | |
|
Re: IP Number Regex
by snowcrash (Friar) on Jul 23, 2001 at 09:37 UTC | |
|
Re: IP Number Regex
by petdance (Parson) on Jul 23, 2001 at 04:53 UTC | |
|
Re: IP Number Regex
by miyagawa (Chaplain) on Jul 23, 2001 at 09:54 UTC | |
|
Re: IP Number Regex
by converter (Priest) on Jul 23, 2001 at 09:00 UTC |