Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.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 使用记事本++;_Regex_Tags_Notepad++ - Fatal编程技术网

Regex 使用记事本++;

Regex 使用记事本++;,regex,tags,notepad++,Regex,Tags,Notepad++,xml文件包含多个标记,其中一些具有值,一些为空,如 <main> <text></text> <text> </text> <text></text> <text>test str</text> <text></text> </main> 测试str 正如您所看到的,只有一个非空文本标记,在npp中,如何使用正则表达式在xml中找到此

xml文件包含多个标记,其中一些具有值,一些为空,如

<main>
  <text></text> <text>   </text> <text></text> <text>test str</text>
  <text></text>
</main>

测试str
正如您所看到的,只有一个非空文本标记,在npp中,如何使用正则表达式在xml中找到此类非空标记。我不希望表达式与带有空格的标记相匹配

因此,在执行find之后,它应该与teststr匹配


我已经尝试了
(\S+)
,但这不起作用。

您可以使用这个正则表达式,它查找一个
标记,后跟一些空格,然后是一个非空格字符,使用负向前看来断言我们不在结束标记处:

<text>\s*(?!</text>)\S.*?</text>
\s*(?!)\s.*?