Notepad++ regex replace wildcard capture group

Notepad++ regex table

Regex Example Group Text
Find what Before Replace With After
\u\w+ Aristotel \l$0\E aristotel
(. –)([A-Z])(.+) . -Aristotel N/A N/A
( -)([A-Z])(.+) -Aristotel ;man;1;0 N/A N/A
( ~)([A-Z])(.+) ~Aristotel ! not N/A N/A
^\u[\w+\s]+\r\n Seoul South Korea N/A N/A
\b\u[\w+\s]+[\r|\s]\b Guangzhou China N/A N/A
[0-9]+. 3. 1. 'Yes!' 2. N/A N/A
((\w)+) ' Animal 'Tiger ['\1', [' ['Animal', ['Tiger
\w+,$ Tiger, Lion, Mouse , '\1' 'Tiger', 'Lion', 'Mouse'
(\d+)(\s)+(\d+) 456 872 \1 separate \3 456 separate 872
(.*)\r\n Java 9 "\1",\r\n "Java 9",
(.*)="(\d+)" class="1505" $2 1505
([a-zA-Z0-9-]+)\.([a-zA-Z0-9-]+)$ blog.softhints.com N/A N/A
(.*)([a-zA-Z0-9-]+)\.([a-zA-Z0-9-]+)$ blog.softhints.com \2.\3 softhints.com
(\b\d+)\s(\u) 1 Hong Kong Hong \1@\2 1@Hong Kong Hong
(\u|\l)\s(\d) Rome Italy 9,396.4 \1@\2 Rome Italy@9,396.4

How to use the table:

  • Open Notepad++
  • Replace menu
  • Set Search mode to Regular Expression
  • Fill Column REGEX / FIND WHAT
  • Fill Column GROUP / REPLACE WITH - in case of N/A this would remove the found result; for example: 1000$$ -> 1000 if you want to remove $$
  • Test result by find
  • Do back up of the file
  • Replace All and compare results

Notepad++ regex replace numbers

  • Open Notepad++ with the file for replace
  • Replace menu Ctrl+H
  • or Find menu - Ctrl+F
  • check the Regular expression (at the bottom)
  • Write in Find what
  • \d+
  • Replace with:
  • X
  • ReplaceAll

Before:

text
23	45
456	872

After:

text
X	X
X	X

Notepad++ regex replace capture groups

  • Open Notepad++ with the file for replace
  • Replace menu Ctrl+H
  • or Find menu - Ctrl+F
  • check the Regular expression (at the bottom)
  • Write in Find what
  • (\d+)(\s)+(\d+)
  • Replace with:
  • \1 separate \3
  • ReplaceAll

Before:

234	45
46	872
1569	489
718	357
789 941

After:

234 separate  45
46 separate  872
1569 separate  489
718 separate  357
789 separate  941

Notepad++ regex add quotes and commas

  • Open Notepad++ with the file for replace
  • Replace menu Ctrl+H
  • or Find menu - Ctrl+F
  • check the Regular expression (at the bottom)
  • Write in Find what
  • (.*)\r\n
  • Replace with:
  • "\1",\r\n
  • ReplaceAll

Before:

Java
Java 9
Python 
Javascript

After:

"Java",
"Java 9",
"Python ",
"Javascript",

Related Article