I am a night person, the wee hours are when I get most inspired. Here’s a regular expression I wrote last night, um, make that this morning. It matches an IP address, and also ensures that the values are within the allowed range (0-255).
(((d{1,2})|(1d{2})|(2[0-4]d)|(25[0-5])).){3}((d{1,2})|(1d{2})|(2[0-4]d)|(25[0-5]))
Leave a Reply