Norse
Norse

Reputation: 5757

MySQL REGEXP Get everything between integers

How could I get all of the contents between single digit integers? Like this string:

7get this text9

I've tried:

SELECT * FROM `test` WHERE `file` REGEXP '[0-9](.*?)[0-9]'

But this throws mysql error:

Got error 'repetition-operator operand invalid' from regexp

How do you do this ?

Upvotes: 1

Views: 580

Answers (1)

Lieven Keersmaekers
Lieven Keersmaekers

Reputation: 58431

You have two repetition operators, * and ? following each other.

Removing the ? would select the text you are searching for.

SQL Fiddle

Upvotes: 4

Related Questions