How would I use regex to check for a value that has two fixed uppercase letters followed by numeric values in PHP or jQuery? -
an example "su1203" or "up1234" or 2 letters followed numeric values. thanks
this can solved quite simple expression
^[a-z]{2}\d+$ in javascript can use test() method:
if(/^[a-z]{2}\d+$/.test(str)) and in php, preg_match:
if(preg_match('/^[a-z]{2}\d+$/', $str) === 1) i suggest learn regular expressions.
see also:
Comments
Post a Comment