Hi, new to preg_match and need a expression to validate that the number is between 25 and 45. Anyone can help?
$pattern = '/2[5-9]|3[0-9]|4[0-5]/';
Thank you.
Don't forget the assertion or this will match any string that contains the above numbers, e.g. 3427432983429.
Wouldn't a numeric comparison like $n>=25 && $n<=45 be more efficient?
This check is a small part of a big validation pattern against Delta credit card numbers. preg_match in this case is of better use (more dynamic) as you can define the check patterns and store them in db.