Export all regular expression matches in Textpad or Notepad++ as a list


In Textpad or Notepad++ is there an option to export all the matches for a regular expression find, as a single list?

In a big text file, I am searching for tags (words enclosed in % %), using regular expression %\< and \>%, and want all the matches as a single list, so that I can remove duplicates using Excel and get a list of unique tags.

Best Answer

You can achieve this by using Backreferences and Find and Mark functionality in Notepad++.

  1. Find the matches using regex (say %(.*?)% ) and replace it by \n%\1%\n , after this we will have our target word in separate lines (i.e. no line will have more than one matched word)

  2. Use the Search-->Find-->Mark functionality to mark each line with regex %(.*?)% and remember to tick 'Bookmark Line' before marking the text

  3. Select Search-->Bookmark-->Remove Unmarked Lines
  4. Save the remaining text. It is the required list.