Alec Muffett <alec.muffett(a)gmail.com> wrote:
I once got into a bunfight with a Googler on the topic
of coding interview
questions, on a related matter. He was promulgating a regular expression to
correctly match/parse-out legitimate dotted-quad IPv4 addresses
That seems an excellent illustration of "now they have
two problems." (And now do IPv6.)
If you need to pull IP addresses from text, the most
liberal regex will generally be "good enough"; if you
must be certain, feed the string to inet_aton(3).
:-)
-Jan