in reply to (shockme) Re: Regex for IP and Optional Port
in thread Regex for IP and Optional Port

Keep in mind that a valid IP address is matched by this beast, as found in the Ram Book:
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])$/;
Since this is a rather unwieldy expression, and rather static, it should be quite easy to compile it once with qr// and insert it as needed.

-- Dave