I have a table like this:
+----+---------------------------------------------------+
| id | value |
+----+---------------------------------------------------+
| 1 | My favourite website is http://stackoverflow.com/ |
| 2 | This text doesn't have a link! :( |
| 3 | Hi! A link! http://www.google.com/ |
+----+---------------------------------------------------+
But of course with many rows. What I really want is a list of all the URLs in the fields. In reality they are blog posts, so some will have more than one link. I’m only interested in external links (i.e. start with (/http(s)?/) ).
So, my first thought was to perform a SQL query that returns something like:
My favourite website is http://stackoverflow.com/,This text doesn't have a link! :(,Hi! A link! http://www.google.com/
so I can use regex in PHP.
How do I write that query?
Alternatively, it would be great to go straight to list of URLs with SQL, but I suspect that might be too hard due to the multiple links thing.
Any ideas?
use
GROUP_CONCATOTHER SOURCE