描述
该表达式将:
- 查找具有属性的数据标签
name=$this.icon
- 避免使用正则表达式读取非常规标记语言的一些棘手问题
<data\b(?=\s)(?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*?\sname="\$this\.Icon")(?:[^>=]|='[^']*'|="[^"]*"|=[^'"\s]*)*"\s?\/?>(?:(?!<\/data>)[\s\S])*?<\/data>
例子
现场示例:http ://www.rubular.com/r/FqdOI8H27X
示例文本
注意第一个数据标签有一些困难的边缘情况
<data onmouseover=' name="$this.Icon" ; funReplace("</data>", name) ; ' type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAgAICAQAAEABADoAgAAhgAAABAQEAABAAQAKAEAAG4DAAAwMAAAAQAIAKgOAACWBAAAICAAAAEA
...
rEGAAaxBgAGsQYABrEHAAaxBwAOsQeAHrEHgH6xB+D+sQf//rEE=
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAgAICAQAAEABADoAgAAhgAAABAQEAABAAQAKAEAAG4DAAAwMAAAAQAIAKgOAACWBAAAICAAAAEA
...
rEGAAaxBgAGsQYABrEHAAaxBwAOsQeAHrEHgH6xB+D+sQf//rEE=
</value>
</data>
火柴
[0] => <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAgAICAQAAEABADoAgAAhgAAABAQEAABAAQAKAEAAG4DAAAwMAAAAQAIAKgOAACWBAAAICAAAAEA
...
rEGAAaxBgAGsQYABrEHAAaxBwAOsQeAHrEHgH6xB+D+sQf//rEE=
</value>
</data>