Replace regexp capture-group in Notepad++?

RegexNotepad++

Regex Problem Overview


Quick question: I have a regexp, ^(?:\b[A-Z]+\b\s+)+(.*)\d{8}, that gives two capture groups. I would like to replace capture group 1 with a whitespace. Is that possible?

If I do replace with: \1 it replaces TEST TESTER Hello, world. Another word here. 75793250 -> with Hello, world. Another word here. I want this result: TEST TESTER 75793250. Replacing the \1 with a whitespace.

Regex Solutions


Solution 1 - Regex

Try using:

^((?:\b[A-Z]+\b\s+)+)(?:.*)(\d{8})

And replace with:

\1\2

Solution 2 - Regex

Do it this way:

Regex: ^(\b[A-Z]+\b\s+)+(?:.*)(\d{8})

Replace with: \1 \2

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKaahView Question on Stackoverflow
Solution 1 - RegexJerryView Answer on Stackoverflow
Solution 2 - RegexAnirudhaView Answer on Stackoverflow