Reputation: 584
I need to do a MySQL select on field that contains multiple words separated by spaces. The field looks something like this: The files
field contains an entry
"000asdf0515 000azxc0515 000apoi0515"
I need to select only one word matching a specific string, say zxc
:
SELECT [whatever the query is]
-> "000azxc0515"
I've been reading in http://dev.mysql.com/doc/refman/5.0/en/string-functions.html for a solution that might work, but I so far don't see anything.
Is there a MySQL function that will do this or will I need to write my own?
Upvotes: 1
Views: 523
Reputation: 792
Mysql doesn't have regex tools for extracting sub-strings. Not out of the box that is. You need to get some extentions https://github.com/mysqludf/lib_mysqludf_preg
This answer is based on: https://stackoverflow.com/a/18307241/788634
Upvotes: 1