...

View Full Version : string contains regex , like ?



BubikolRamios
09-23-2011, 07:35 AM
string:
',12,13,14,15,'

how to figure out that it contains 13 and 15 ?

Keleth
09-23-2011, 08:23 AM
You can go with either one.

SELECT * FROM table WHERE string LIKE '%13%

or

SELECT * FROM table WHERE string REGEXP '.*13.*'

BubikolRamios
09-23-2011, 11:15 AM
how to figure out that it contains 13 and 15 ?


The 13 is easy. But 13 and 15 ?
Besides '%...%' is very slow, barely usable, that is, not usable at all, at least on MySql.

Keleth
09-23-2011, 05:58 PM
Oh, both...

Then just do AND string REGEXP '.*15.*'

As for using LIKE, I know its slower then other things, but barely if not useable in mySQL? I've been using it for a while with no notable issues.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum