1

I'm having some trouble about replacing option string. I need to replace:

tag1 any word or numbers tag1

to

tag2 any word or numbers tag2

However, the text between tags can not be changed and it is variable.

Example:

From:
tag1 America tag1
tag1 Africa tag1
tag1 South America tag1
tag1 Asia tag1
tag1 Oceania tag1

To:

tag2 America tag2
tag2 Africa tag2
tag2 South America tag2
tag2 Asia tag2
tag2 Oceania tag2

There is about 50.000 lines with diferent texts between tag1.

Thanks in advance.

2

Here's how I did it with Notepad++ using the Ctrl+H option and then by replacing tag1 with tag2 and the other options set as listed below in the screen shot and pointed out specifically. This will work with the Search Mode set to Regular Expression or as Normal Search.

enter image description here enter image description here

Before

tag1 America tag1
tag1 Africa tag1
tag1 South America tag1
tag1 Asia tag1
tag1 Oceania tag1

After

tag2 America tag2
tag2 Africa tag2
tag2 South America tag2
tag2 Asia tag2
tag2 Oceania tag2
  • 1
    This approach probably fails if the file contains an odd number of occurrences of tag1. – aventurin Sep 2 '16 at 20:37
  • 3
    even normal notepad which comes with windows could do this :o – Kage Sep 2 '16 at 20:41
1

Find what:

tag1(.*)tag1

Replace with:

replacement1$1replacement2

[x] Regular expression

Hereby replacement1 or replacement2 may be equal to tag1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.