Community
    • Login

    Search/Replace with REGEX capturing groups

    Scheduled Pinned Locked Moved General Discussion
    search & replaceregexcapturing group
    3 Posts 3 Posters 15.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Benevolent DeityB
      Benevolent Deity
      last edited by

      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!

      Terry RT Alan KilbornA 2 Replies Last reply Reply Quote 0
      • Terry RT
        Terry R @Benevolent Deity
        last edited by

        @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.

        1 Reply Last reply Reply Quote 2
        • Alan KilbornA
          Alan Kilborn @Benevolent Deity
          last edited by

          @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.

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors