Help with REGEXP

Hi,

I have a table in which one column stores some alphanumeric values
I am trying to get a count of records in my database that have a particular format (and those that don’t)
The column has values in the following formats
AAxxxxxxxxxAAAAA
and
xxxxxxxxxxxxxxxx

where AA are alpha characters and xxxx are numeric characters
I tried the following to get the count of ones formated like AAxxxxxxxxxAAAAA
I also tried replacing the REGEXP with like
but still I am getting 0 all the time


SELECT count( * )
FROM mytable
WHERE myfield
REGEXP '[A-Z]{2}-[0-9]{9}-[A-Z]{5}';

Any help would be appretiated :slight_smile:
Thanks

You are on the right track with the RegExp here. But you must remove the dashes. They will be interpreted literally, and based on what you describe your data does not contain any dashes.


[A-Z]{2}[0-9]{9}[A-Z]{5}

wow, lol
Thank you!!!