Extract multiple values from one column in MySql
- by Neil
I've noticed that MySql has an extensive search capacity, allowing both wildcards and regular expressions. However, I'm in somewhat in a bind since I'm trying to extract multiple values from a single string in my select query.
For example, if I had the text "<span>Test</span> this <span>query</span>", perhaps using regular expressions I could find and extract values "Test" or "query", but in my case, I have potentially n such strings to extract. And since I can't define n columns in my select statement, that means I'm stuck.
Is there anyway I could have a list of values (ideally separated by commas) of any text contained with span tags?
In other words, if I ran this query, I would get "Test,query" as the value of spanlist:
select <insert logic here> as spanlist from HtmlPages ...