Community
    • Login

    How to Replace a Matching Parenthetical up to the First Closing Parenthesis

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 909 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.
    • ZetawilkZ
      Zetawilk
      last edited by

      (Foo,1234567890) (bar)

      where the numerical string after Foo, can be any set of numbers, and where this sequence is repeated an indefinite quantity of times in a long list with or without including (bar) on each line.

      Task: You must replace (Foo,1234567890) without replacing any instance of (bar).

      The regular expressions on http://docs.notepad-plus-plus.org/index.php/Regular_Expressions are not functioning, or else poorly explained in human language.

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

        @Zetawilk

        Your request is kinda vague, at least to me, but let’s get the ball rolling:

        Find: \(\w+,\d+\) <----note the trailing space
        Search mode: (obviously) Reg exp

        Probably not what you want, but to me it works the way I understand the “spec” that has been presented.

        1 Reply Last reply Reply Quote 1
        • ZetawilkZ
          Zetawilk
          last edited by

          I’m unable to edit the topic post for undisclosed reasons. The set of numbers after (Foo, can be in hexadecimal. I can’t possibly imagine what else you thought was “vague”.

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

            Posts are only editable for 3 minutes.

            With the new spec, I would try:

            Find: (?i)\(\w+,[0-9A-F]+\)

            1 Reply Last reply Reply Quote 3
            • ZetawilkZ
              Zetawilk
              last edited by

              Thank you very much for your assistance. This issue is now resolved.

              1 Reply Last reply Reply Quote 2
              • guy038G
                guy038
                last edited by guy038

                @zetawilk, @alan-kilborn and All,

                @zetawilk, in your initial post, you said :

                Task: You must replace (Foo,1234567890) without replacing any instance of (bar)

                You’re not asking, here, for any commercial demand. Personally, I would have written, preferably :

                Request : replace (Foo,1234567890) without replacing any instance of (bar)

                and thanked, in advance, possible repliers, for their [free] help !

                Just remember it, in your next posts ;-))

                Best regards,

                guy038

                P.S. :

                I just forgot your last post. So, let me temper my criticism because you did thank Alan for his answers !

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