Stanz
Stanz

Reputation: 13

Regex Find/Replace in Notepad++ including new lines

Need to replace/remove multiple occurrences in notepad++ using regex. Here is an example:

....
something<item>text to be removed or replaced</item>
text<item>another text to be
removed or replaced</item>
<item>more text to be removed or 
replaced</item>
...

I need to replace/remove everything in between "<item>" and "</item>", matches could include a new line.

So I would end up with something like this:

....
something<item></item>
text<item></item>
<item></item>
...

Upvotes: 0

Views: 2046

Answers (1)

Gomiero
Gomiero

Reputation: 2300

One way to do this find/replace:

Find what: (<item>).*?(<\/item>)\R?

Replace with: $1$2

Check the Matches new line checkbox.

enter image description here

More information: Notepad++ User Manual - Regular Expressions

Upvotes: 5

Related Questions