Adam Bregenzer wrote:

On Mon, 2004-02-02 at 14:15, Jas wrote:

I have tried this but its not working.
!eregi("^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$",$_POST['mac'])


so it should match 2 characters 0-9a-fA-F
each block of 2 characters is followed by a : and repreated in 6
blocks.


That's a long expression, try:
!preg_match('/^([0-9a-f]{2}($|:)){6}/i', $_POST['mac']);

This pattern finds 6 matches of a number or letter (the /i means
case-insensitive) followed by either a ':' or the end of the string.

Thanks, that worked like a charm.
Jas

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to