$ip =~ 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;
should do the trick.
Update
Thanks to tadman for more thorough testing. Regex updated to correct transcription error. Should work on Quad dotted IP's but sadly it still does not support base10 IP's :(.
Update 2 tadman does it again '/x' added to prevent line-break well ... breaking it. Also could some one get me a mop I seem to be bleeding all over the floor.
mitd-Made in the Dark
'My favourite colour appears to be grey.'
In reply to Re: Valid IP?
by mitd
in thread Valid IP?
by Monolith-0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |