在记事本中使用正则表达式删除标签之间的文本 [英] Remove text between the tags using regular expression in notepad
问题描述
我有以下 xml 标签:
和
I have following xml tags:
<EmployerName>company name</EmployerName>
and <Email>name@gmail.com</Email>
我正在使用以下正则表达式-
删除标签之间的数据.但是,数据并没有被删除.有什么想法吗?
I am using the following regular expression-
<EmployerName>[0-9A-Z:-]*</EmployerName>
to remove the data between tags. But, the data is not getting removed. Any idea?
推荐答案
如果你想匹配标签内的所有内容,只需使用 .
:
If you want to match everything within the tags, just use .
:
<EmployerName>.*</EmployerName>
您的字符组 [0-9A-Z:-]
包括数字、字母、冒号和连字符,但不包括空格或其他特殊字符.
Your character group [0-9A-Z:-]
covers digits, letters, the colon and the hyphen characters, but it doesn't include whitespace or other special characters.
然后你可以简单地替换为
.
Then you can replace with simply <EmployerName></EmployerName>
.
如果同一行有多个 EmployerName
元素,请使用勉强匹配:
In case there are multiple EmployerName
elements on the same line, use a reluctant match:
<EmployerName>.*?</EmployerName>
这篇关于在记事本中使用正则表达式删除标签之间的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!