Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove text between the tags using regular expression in notepad

I have following xml tags: <EmployerName>company name</EmployerName> and <Email>[email protected]</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?

like image 346
user2961127 Avatar asked Dec 20 '25 19:12

user2961127


1 Answers

If you want to match everything within the tags, just use .:

<EmployerName>.*</EmployerName>

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>.

In case there are multiple EmployerName elements on the same line, use a reluctant match:

<EmployerName>.*?</EmployerName>
like image 122
M A Avatar answered Dec 22 '25 11:12

M A



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!