0

I have a question regarding notepad++. I have this text:

enter image description here

And this second one:

enter image description here

Basically I want to delete the countries that appear in image 2, from image 1. How can I do this?

  • 2
    don't put text in images. Paste a small sample so that people can try – phuclv Jan 25 at 3:08
3

You should be able to do this in Notepad++ as follows:

  1. Use a normal Find & Replace to replace all the commas in List 2 with ,|, so you end up with a list of countries to delete like Country1,|Country2,|Country3,.
  2. Use this new list as the search term in a Regular Expression mode Find & Replace on List 1, with a blank as the replacement text.

Note that this assumes that country names are just separated by commas (no spaces). The last entry in List 1 should also be followed by a comma, otherwise it won't get matched by the search.

  • note that Country3 doesn't have a comma so you'll have a redundant comma where it was removed – phuclv Jan 25 at 3:10
  • Good spot @phuclv. I've updated my answer to correct this. – JRI Jan 25 at 9:11
  • you also need to put a comma to the end of List 1, otherwise the last item won't be matched even if it's in the list – phuclv Jan 25 at 15:54
  • That's right - I put that in my earlier edit too! :-) – JRI Jan 25 at 18:17
0

I do not know how to automate your task in the Notepad++, but if your lists' data are not security critical, you can use script I have written in jsfiddle: https://jsfiddle.net/RomanTarasiuk/ev0fzsog/. Or save the script text into a *.html file and open it in your browser – this way is completely secure, and my script is as simple as possible and cannot damage your computer/smartphone.

Format each of your two lists that each of them are placed in one line, values in them are separated by comma only (no spaces). Put your two lists into first and second textarea accordingly and press button, and your result list will be placed to the third textarea.

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.