[thelist] [MySQL] regexp in query

apathetic apatheticgenius at gmail.com
Wed Dec 15 09:49:51 CST 2004


On Wed, 15 Dec 2004 10:11:27 +1300, Paul Bennett <Paul.Bennett at eyede.com> wrote:
> "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 think the problem is that the first + is redundant because it
immediately follows {4}.

Try:

"^[:digit:]{4}/{1}[:digit:]{4}$"

+ = one or more of the preceeding character
{4} = exactly four of the preceeding character

Tim

-- 
Elaborate - Free PHP/MySQL wiki engine
http://www.apatheticgenius.com/projects/elaborate/


More information about the thelist mailing list