Notepad++ regex find group of words and replace

You can check other example here:
Notepad++ regex replace capture group examples list
Notepad++ regex replace wildcard capture group

regex separate group of words from other values

  • Open the file in Notepad++
  • Replace CTRL + H
  • Add quotes to words(two times for the last/first column):
  • 1 Rome Italy - > 1@Rome Italy
  • Find what - (\b\d+)\s(\u)
  • Replace with - \1@\2
  • Tokyo Japan 24 - > Tokyo Japan@24
  • Find what - (\u|\l)\s(\d)
  • Replace with - \1@\2

Before

1 Rome Italy 11.8% 2 210,404.4 111,951.9
2 Tokyo Japan 24.8% 0 312,366.2 114,654.8

After

1@Rome Italy@11.8% 2 210,404.4 111,951.9
2@Tokyo Japan@24.8% 0 312,366.2 114,654.8

find group of words

  • Open the file in Notepad++
  • Replace CTRL + H
  • Add quotes to words(two times for the last/first column):
  • Find only: "Seoul South Korea", "Guangzhou China", "Prague Czech Republic"
  • Find what - ^\u[\w+\s]+\r\n
  • Find what - \b\u[\w+\s]+[\r|\s]\b

Find group of capitalized words

9764
Seoul
South Korea
-1734$
6
9,159.1 
13,229.7 
17
Guangzhou
China
8,182.5 
8,550.7
-14.9%
Prague
Czech Republic
8,182.5 
8,550.7

Related Article