Community

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

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

    Help wanted · · · – – – · · ·
    3
    6
    616
    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.
    • Zetawilk
      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 Kilborn 1 Reply Last reply Reply Quote 0
      • Alan Kilborn
        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
        • Zetawilk
          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 Kilborn
            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
            • Zetawilk
              Zetawilk last edited by

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

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