Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex xml中的多行匹配模式_Regex_Sublimetext2 - Fatal编程技术网

Regex xml中的多行匹配模式

Regex xml中的多行匹配模式,regex,sublimetext2,Regex,Sublimetext2,如何匹配以下模式: <aaa class = "dog"> <bbb id = "one"/> </aaa> <aaa class = "dog"> <bbb id = "two"/> </aaa> <aaa class = "dog"> <bbb id = "three"/> </aaa> 但它符合: <aaa class = "dog"> <

如何匹配以下模式:

<aaa class = "dog">
   <bbb id = "one"/>
</aaa>
<aaa class = "dog">
   <bbb id = "two"/>
</aaa>
<aaa class = "dog">
   <bbb id = "three"/>
</aaa>
但它符合:

<aaa class = "dog">
   <bbb id = "one"/>
</aaa>
<aaa class = "dog">
   <bbb id = "two"/>
</aaa>
<aaa class = "dog">
   <bbb id = "three


如果要匹配上述三行,可以使用以下正则表达式:

<aaa class = "dog">[\r\n\t\s]*<bbb id = "three"/>[\r\n\t\s]*</aaa>
[\r\n\t\s]*[\r\n\t\s]*

由于您的正则表达式以(三)结尾,它肯定会匹配到“三”。您想匹配准确的文本吗?实际上,我希望它匹配“我想要:”中所述的三行,即
静态?例如,你能使用
^
?我想要的是全部三行:
<aaa class = "dog">
   <bbb id = "one"/>
</aaa>
<aaa class = "dog">
   <bbb id = "two"/>
</aaa>
<aaa class = "dog">
   <bbb id = "three
<aaa class = "dog">[\r\n\t\s]*<bbb id = "three"/>[\r\n\t\s]*</aaa>