Search/Replace with REGEX capturing groups
-
Hello,
How can I use the content of a Regex capturing group in my replacement string when doing a search and replace with Notepad++?
Thanks!
-
@benevolent-deity said in Search/Replace with REGEX capturing groups:
How can I use the content of a Regex capturing group in my replacement string when doing a search and replace with Notepad++?
First thoughts are that you should be learning how regex is coded, hence go to the FAQ section and take the web links to documents that can help. Secondly, how about looking at some of the posts in this forum. You will find some simple regex, more complicated ones and others that you should not try to understand until you have the basics sorted.
As your question was not specific enough, that’s all the help I can provide.
If you supply specific examples that you need help on, someone will give that help. Read the pinned posts which explain how examples should be provided.
Terry
In short, each capture group is assigned a number, which increases, such as 1,2,3 etc. In the replacement field each is referenced like \1,\2,\3 etc but as I say, try to learn it from the reference links.
-
@benevolent-deity said in Search/Replace with REGEX capturing groups:
How can I use the content of a Regex capturing group in my replacement string when doing a search and replace with Notepad++?
To use capture group 1, put
\1
or$1
or${1}
in your replacement string. Similar for other numbered capture groups.