[thelist] PHP: is_numeric... that's the question...

tim tim at hyperlinkage.com
Wed Jan 17 12:40:20 CST 2007

Tris wrote:
> the inout shoud be:
> 2 x letters
> 5 x numbers
> eg: fr23454 / kr55555 / AP84754

This is a perfect example of a scenario where a single regular 
expression can replace a whole lot of code.


$pattern = "/^[a-zA-Z]{2}[0-9]{5}$/";

return preg_match( $pattern, $subject );


More information about the thelist mailing list