[TUHS] regex early discussions

Jan Schaumann via TUHS tuhs at tuhs.org
Tue Mar 5 00:25:00 AEST 2024


Alec Muffett <alec.muffett at 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


More information about the TUHS mailing list