I’m looking for a regex that will match against: X_X
Where X is always a number great than zero and there must be an underscore character in between the two numbers.
Thanks.
EDIT: When I run
$pattern = “[1-9]_[1-9]”; if(
preg_match($pattern, $key) ) return
TRUE;
I get Warnings:
Message: preg_match()
[function.preg-match]: Unknown
modifier ‘_’
The following should do what you want:
Note that this will work for numbers with more than one digit as well, if
Xin your example is only a single digit number then you can remove the\d*.