[thelist] [MySQL] regexp in query
Paul Bennett
Paul.Bennett at eyede.com
Tue Dec 14 15:11:27 CST 2004
Hi,
I'm looking to formulate a query wich will select only values with the
following format 0000/0000 from a field in a table.
I have tried this:
"SELECT DISTINCT licencing_year
FROM licence
WHERE licencing_year
REGEXP "^[:digit:]{4}+/+[:digit:]{4}$"
and received this helpful error message from mysql:
"|repetition-operator operand invalid|"
I am guessing this is due to the "/" so I have modified the query to this:
"SELECT DISTINCT licencing_year
FROM licence
WHERE licencing_year
REGEXP "^[:digit:]{4}+.+[:digit:]{4}$"
where the "." should represent "any character"
but still get the same error - any ideas?
--
Paul Bennett
Web Technologies Developer
Eyede International Limited
Level 1, 5 Bouverie Street
PETONE
PO Box 31 012
Lower Hutt
Phone +64 4 939 8764
Fax +64 4 939 6719
www.eyede.com
More information about the thelist
mailing list