Skip to content

Instantly share code, notes, and snippets.

@sposmen
Created August 20, 2013 21:48
Show Gist options
  • Select an option

  • Save sposmen/6287781 to your computer and use it in GitHub Desktop.

Select an option

Save sposmen/6287781 to your computer and use it in GitHub Desktop.
Select from an XML the img src
select id, url from
(
select id, array_to_string(regexp_matches(possible, 'src=[\s\\]*"(https?:\/\/.*)"', 'g'), ',') as url
from (
select id, array_to_string(regexp_matches(xml::text , '(<img .*?>)', 'g'), ',') as possible from victorious_squirrel_widgets
where xml::text ~ '(<img .*?>)'
) as foo
) as foo2
where url not like '%URL_NOT_NEEDED%'
order by id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment