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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top