我在URL的应用程序中有一个自由格式的文本字段。没有固定的格式,因此我正在努力从文本中提取URL。文本中可以嵌入多个URL。如何单独提取它们?谢谢!
示例
<p><span style="font-size:14px"><span style="font-family:calibri"> Final Rule: <u><span style="color:blue"><a href="https://www.google.com/rules/final/2011/33-10345.pdf"><span style="color:blue">Disclosure</span></a></span></u></span></span></p>
<p><span style="font-size:14px"><span style="font-family:calibri">Press Release: <span style="color:blue"><a href="https://www.co.gov/news/press-release"><span style="color:blue">Hedging Policies</span></a></span></span></span></p>
答案 0 :(得分:2)
也许是这样吗?
select REGEXP_SUBSTR(col,'a href="(.*?)"',1,level,null,1) as url
from t
connect by level<=REGEXP_COUNT(col,'a href="(.*?)"')
and prior id = id --add these 2 lines to extract from multiple
and prior sys_guid() is not null; --rows in a table where id is the primary key.