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
\1or$1or${1}in your replacement string. Similar for other numbered capture groups.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better đź’—
Register Login