0

I have a text document where every line has an opening tag. I need to add a matching closing tag at the end of each line.

For example:

What I have:<exe>Example text between tags.

What I need:<exe>Example text between tags.</exe>

I am new to "Find & Replace" in Notepad++ but I've had some success formatting this document to my needs. Can someone provides some guidance/tips?

1
  • Does every line have an opening tag at the beginning?
    – Paul
    Aug 19, 2015 at 0:20

1 Answer 1

2

This will put a matching closing tag at the end of every line. Go to search/replace and choose regex as the search mode.

Find what: ^<(.+)>(.+)$
Replace with: <\1>\2</\1>

The find what looks for the opening tag at the beginning of the line, and stores it in \1, and puts the rest of the line in \2

We then create the new line in the replace using \1 for the opening and closing tags, and \2 for the content in between.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .