| preg match help
|
FiRe

msg:3386269 | 6:11 pm on Jul 4, 2007 (gmt 0) | Can anyone pls help me write the regex for validating $id using ereg or preg_match? $id will consist of any number, followed by a ; followed by a 1 or 2. For example: 1283;1 232;1 1932034;2 0018;2 5;1 etc. Thanks in advanced!
|
milanmk

msg:3386295 | 6:47 pm on Jul 4, 2007 (gmt 0) | if (preg_match("^[0-9]+;[12]{1}$", $id)) { echo "A match was found."; } else { echo "A match was not found."; } Milan
|
|
|