mysql - Require letter in [A-Z] set -
i'm trying match number plates in database using regex can set them type, don't have use regex in future queries.
i've got 2 expressions match dateless / irish plates. need separate irish plates dateless plates.
irish plates must include letter or z, dateless plates cannot include or z.
these 2 expressions match both dateless , irish.
regexp '^[a-z]{1,3}[0-9]{1,4}$' regexp '^[0-9]{1,4}[a-z]{1,3}$'
the problem have excluding i-z, can [a-hj-y], result in crossovers.
how can modify expressions above require , z, , set of expressions exclude , z.
many thanks
irish plates either:
^([iz][a-z]{0,2}|[a-z]([iz][a-z]?|[a-z][iz]))[0-9]{1,4}$
^[0-9]{1,4}([iz][a-z]{0,2}|[a-z]([iz][a-z]?|[a-z][iz]))$
if you're prepared tolerate 5 letters, these can simplified to:
^[a-z]{0,2}[iz][a-z]{0,2}[0-9]{1,4}$
^[0-9]{1,4}[a-z]{0,2}[iz][a-z]{0,2}$
dateless plates either:
^[a-hj-y]{1,3}[0-9]{1,4}$
^[0-9]{1,4}[a-hj-y]{1,3}$