• Login
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.
  • Z
    Zetawilk
    last edited by Jan 26, 2019, 4:23 PM

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

    A 1 Reply Last reply Jan 26, 2019, 5:02 PM Reply Quote 0
    • A
      Alan Kilborn @Zetawilk
      last edited by Jan 26, 2019, 5:02 PM

      @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
      • Z
        Zetawilk
        last edited by Jan 26, 2019, 6:03 PM

        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
        • A
          Alan Kilborn
          last edited by Jan 26, 2019, 6:18 PM

          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
          • Z
            Zetawilk
            last edited by Jan 26, 2019, 6:33 PM

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

            1 Reply Last reply Reply Quote 2
            • G
              guy038
              last edited by guy038 Jan 27, 2019, 9:36 PM Jan 27, 2019, 9:13 PM

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