Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql regex match any character except line break

Tags:

regex

mysql

I would like to use a regex using regexp instruction in a mysql query. The regex contains a rule any character except line break.

SELECT * FROM column regexp 'EXP1.*=*.*EXP2'

But mysql seams to treat .* as any character including line break

Any ideas how to change the regex to match any character except line break

Thanks

like image 569
FIF Avatar asked Mar 20 '14 16:03

FIF


1 Answers

Depending on your line ending style, you could either use [^\n]* to match anything other than line feeds, or [^\n\r]* to match anything other than line feeds and carriage returns.

like image 169
CAustin Avatar answered Sep 30 '22 02:09

CAustin