Community
    • Login

    Find&replace, RegEx, \10

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 4 Posters 3.0k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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 Offline
              astrosofista @Alan Kilborn
              last edited by

              @Alan-Kilborn

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

              1 Reply Last reply Reply Quote 2
              • PeterJonesP Online
                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

                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
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors