我需要从一个大字符串中递归地提取信息从'< a href =“...”> something.jpg </a>'标记,可能包含多个标签。我需要在Oracle 11g上使用正则表达式来执行此操作。Oracle 11g正则表达式模式的多个实例
的我所期待的一个例子是:
示例串:
字符串将始终包含<一>标签的至少1个实例并没有最大限度地它多少能包含
在href将永远是XID - [[:数字:]
标签中的属性可以与字符串我WA变化
<p>text about something important</p><p><a href="@[email protected]@[email protected]/xid-1234_1" target="_blank">file.pdf</a> </p><p><a href="@[email protected]@[email protected]/xid-1235_1" target="_blank">anotherfile.pptx</a> </p><p><a href="@[email protected]@[email protected]/xid-1236_1" target="_blank">yetanotherfile.pdf</a> </p>
现在NT提取使用
REGEXP_SUBSTR 3 <一个...> ... </A>块(<字符串>, '<图案>',<开始>,<发生>),并调整该出现值来获取3个实例。
我至今是:
SELECT REGEXP_SUBSTR(main_data, ''<a[[:print:]]+href="[[:print:]]+xid-1234_1"[[:print:]]+>[[:print:]]+</a>'', 1, 1)
FROM table
和我得到的结果从那些
<a href="@[email protected]@[email protected]/xid-1234_1" target="_blank">file.pdf</a> </p><p><a href="@[email protected]@[email protected]/xid-1235_1" target="_blank">anotherfile.pptx</a> </p><p><a href="@[email protected]@[email protected]/xid-1236_1" target="_blank">yetanotherfile.pdf</a>
所以它开始与第一<一个,然后抓住一路到最后</a>。当我需要它停止在</a>的第一个实例。然后,当我将事件增加到2时,它应该抓取第二组< a> </a>标记。但是,目前将事件设置为2,没有返回任何内容。
任何帮助将不胜感激。谢谢
谢谢,这是我需要什么。 – Matt