[英]Select XML tags which have a specific text in it with REGEX
i am currently working on a regex to select nodes that have "Roger" as a name. 我目前正在使用正则表达式来选择以“ Roger”作为名称的节点。
Ex. 例如
<Person>
<Age>10</Age>
<Name>Roger</Name>
</Person>
<Person>
<Age>15</Age>
<Name>Amelia</Name>
</Person>
<Person>
<Age>45</Age>
<Name>Roger</Name>
</Person>
Currently im trying \\s*[\\s\\S.]*Roger[\\s\\S.] 目前正在尝试\\ s * [\\ s \\ S。] * Roger [\\ s \\ S。]
but everything gets selected and i can't figure out a way to ignore amelia 但是一切都被选择了,我想不出一种忽略阿米莉亚的方法
这应该可以帮助您:
<Person>\s+<Age>\d+</Age>\s+<Name>Roger</Name>\s+</Person>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.