|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-11-03 14:12 UTC] mike at traverse dot net
[2000-11-03 14:35 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 08:00:02 2025 UTC |
Following is a short script that I was writing for a friend. However, what I found in testing it, was that the following interval {4} was acting like {4,} Note specifically the test on $macadd4. Enjoy....:) Thanks, Mike --- <HTML> <BODY> <?php phpinfo(); $macadd1 = "12af.54eb.b23c"; $macadd2 = "12aF.54eb.b23c"; $macadd3 = "12af?54eb.b23c"; $macadd4 = "1111.54eb.b23c111111"; $macadd5 = "12af.4eba.b23c.4567"; $regexstr = "([0-9a-f]{4}\.){2}([0-9a-f]{4})"; if (ereg($regexstr, $macadd1)) { echo ($macadd1 . " is a valid MAC Address!<P>\n"); } else { echo ($macadd1 . " is <b>NOT</b> a valid MAC Address!<P>\n"); } if (ereg($regexstr, $macadd2)) { echo ($macadd2 . " is a valid MAC Address!<P>\n"); } else { echo ($macadd2 . " is <b>NOT</b> a valid MAC Address!<P>\n"); } if (ereg($regexstr, $macadd3)) { echo ($macadd3 . " is a valid MAC Address!<P>\n"); } else { echo ($macadd3 . " is <b>NOT</b> a valid MAC Address!<P>\n"); } if (ereg($regexstr, $macadd4)) { echo ($macadd4 . " is a valid MAC Address!<P>\n"); } else { echo ($macadd4 . " is <b>NOT</b> a valid MAC Address!<P>\n"); } if (ereg($regexstr, $macadd5)) { echo ($macadd5 . " is a valid MAC Address!<P>\n"); } else { echo ($macadd5 . " is <b>NOT</b> a valid MAC Address!<P>\n"); } ?> </body> </html>