I want to validate a numeric string that must only contain numbers ranging from 400 to 550.
$x = "401"; // valid
$x = "551"; // invalid
I want to only match the numbers between 400 and 550.
I tried the following pattern:
if(preg_match_all("/[400-550]+/",$x));
But it doesn't work.
What is the regex pattern for matching numbers 400-550?
[...]defines a character CLASS, which matches a SINGLE CHARACTER in the target text,[400-500]is basically saying find one spot in the string where a character is either4,0,1,2,3,4, or5. e.g.[400-500]is functionally identical to[0-5]. – Marc B May 5 '15 at 14:50