Community
    • Login

    Find&replace, RegEx, \10

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 4 Posters 2.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.
    • Gergely ApróG
      Gergely Apró
      last edited by

      I want to find&replace using regular expression.
      If I put (something) in find and then \number to replace then the text in the bracket won’t be changed. I have 14 brackets in a single command. And when I write \10 to the replace, it return the first bracket and a zero, rather than the stuff in the 10th bracket.

      astrosofistaA PeterJonesP 2 Replies Last reply Reply Quote 0
      • astrosofistaA
        astrosofista @Gergely Apró
        last edited by

        @Gergely-Apró

        If I correctly understood your question, just enclose it in brackets, as in \{10}.

        Take care and have fun!

        Alan KilbornA 1 Reply Last reply Reply Quote 0
        • Alan KilbornA
          Alan Kilborn @astrosofista
          last edited by

          @astrosofista said in Find&replace, RegEx, \10:

          \{10}

          I don’t think that syntax works??

          But this syntax ALWAYS works, in replace:

          ${1} <-- for group 1
          ${2} <-- for group 2
          …
          ${N} <-- for group N

          Thus for OP’s specific problem and example --> ${10} in replace field should work.

          Alan KilbornA astrosofistaA 2 Replies Last reply Reply Quote 3
          • Alan KilbornA
            Alan Kilborn @Alan Kilborn
            last edited by Alan Kilborn

            I neglected to mention the “group 0” match, which has the same syntax format as the ones I DID mention:

            If you happen to need to refer to ALL of the matched text, you can use ${0} to refer to it.

            1 Reply Last reply Reply Quote 1
            • astrosofistaA
              astrosofista @Alan Kilborn
              last edited by

              @Alan-Kilborn

              Yes, my bad, ${10} is the thing.

              1 Reply Last reply Reply Quote 2
              • PeterJonesP
                PeterJones @Gergely Apró
                last edited by

                @Gergely-Apró ,

                The answers you have received are good.

                If you would like more documentation on this, the official Notepad++ docs talk about the substitution expressions here.

                Notepad++ uses what’s known as the “Boost engine” (currently v1.70) for handling the regular expressions, and that has its substitution documentation here

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