-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chris Grau wrote:
> I'm a sucker for ugly regular expressions. Please share.
Women and children may want to avert their eyes:
\b(?:(?: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]?)\b
Or if you want to capture the four numbers of the IP you can use this
monster:
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))?
If you really don't care whether it is a valid IP but just a group of
four numbers you can use:
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
but that is rarely acceptable.
- --
Tracy R Reed Read my blog at http://ultraviolet.org
Key fingerprint = D4A8 4860 535C ABF8 BA97 25A6 F4F2 1829 9615 02AD
Non-GPG signed mail gets read only if I can find it among the spam.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFF3RfM9PIYKZYVAq0RAtymAJkBNoWZovbz2WD3i92U00P0GvCcrwCeJbv2
ukSy0Wdu2c/CkmTgeysPCag=
=R5c8
-----END PGP SIGNATURE-----
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list