0

I just found out that mysql doesn't support full regular expressions syntax. I have to select any couple of digits except of 00 (so, 11, 54, 02, are ok, but not 00).

Normally I would use a negative lookahead like this:

(?!00)[0-9]{2}

But in mysql it is not supported. So how could I do it?

  • have you tried ^ – James Oct 17 at 10:56
  • 2
    Directly: (0[1-9])|([1-9][0-9]). – Akina Oct 17 at 10:58
  • @Akina this works, you should put it as an answer to my question – Luca Reghellin Oct 17 at 13:36
1

Direct solution:

(0[1-9])|([1-9][0-9])

It is simple enough for do not look for shortening or another optimization, I think.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.