News for hackers. Stuff that matters.
Re:National IPv6 launch day in Finland by CountSessine on Tuesday June 09, 2015 @12:02PM (#9686671)
I'm going to hazard a guess and say that Apple probably just wants to make sure that your app doesn't try to do silly things like pass user-input network addresses (like for email apps that need the user to supply an email server address) through parsing regexes like (\d+)\.(\d+)\.(\d+)\.(\d+).
Re:National IPv6 launch day in Finland by istvan__ on Tuesday June 09, 2015 @07:16PM (#9689148)
Just for the record this is not the regexp for matching IP addresses. It is for matching 4 multi digit numbers separated by dots.
Re:National IPv6 launch day in Finland by CountSessine on Tuesday June 09, 2015 @08:53PM (#9689466)
IP addresses will include IPv6 addresses, so no, this is not a good regex for matching IP addresses. Which is the point.
Re:National IPv6 launch day in Finland by yuubi on Wednesday June 10, 2015 @12:32AM (#9690062)
Even in an IPv4-only world, that regexp admits strings like 123.456.7890.12345.
Re:National IPv6 launch day in Finland by CountSessine on Wednesday June 10, 2015 @11:55AM (#9693127)
You're capturing the octets individually. You already have to do bounds checking on RFC 1918 ranges and such. Why wouldn't you do the octet checking in your post-match logic? This is just pedantic.
Re:National IPv6 launch day in Finland by istvan__ on Wednesday June 10, 2015 @12:18PM (#9693312)
How about?

^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$