Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Find&replace, RegEx, \10

    Help wanted · · · – – – · · ·
    4
    6
    64
    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ó
      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.

      astrosofista PeterJones 2 Replies Last reply Reply Quote 0
      • astrosofista
        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 Kilborn 1 Reply Last reply Reply Quote 0
        • Alan Kilborn
          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 Kilborn astrosofista 2 Replies Last reply Reply Quote 3
          • Alan Kilborn
            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
            • astrosofista
              astrosofista @Alan Kilborn last edited by

              @Alan-Kilborn

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

              1 Reply Last reply Reply Quote 2
              • PeterJones
                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
                Copyright © 2014 NodeBB Forums | Contributors