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.
EDIT: When I run
$pattern = "[1-9]_[1-9]";
if (preg_match($pattern, $key))
return TRUE;
I get a Warning:
Message: preg_match() [function.preg-match]: Unknown modifier '_'
The following should do what you want:
preg_match("/[1-9]\d*_[1-9]\d*/", $key)
Note that this will work for numbers with more than one digit as well, if X
in your example is only a single digit number then you can remove the \d*
.