Community
    • Login

    Search after 2 character and delete alle between

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 4.2k 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.
    • Steen Frank MikkelsenS
      Steen Frank Mikkelsen
      last edited by

      Hi

      Can Notepad ++ does this:
      Search for 2 character and delete these two character and all between ?

      Example
      Search after “(” and “)”
      Results:
      (summer)
      (sun)
      (flower)

      and delete all instances of:
      (summer)
      (sun)
      (flower)

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Steen Frank Mikkelsen
        last edited by

        Hello Steen-Frank-Mikkelsen,

        one way would be to use regular expressions with replace dialog.
        When dialog has been opened check Regular Expression in
        Search Mode section.
        Then put the following in Find what: (()(.*)())
        and in Replace with: \1\3

        Cheers
        Claudia

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

          Hello, Steen Frank Mikkelsen and Claudia,

          I think that the correct regex S/R should be :

          • \(.*?\) in the Find what : zone

          • Nothing in the Replace with : zone

          with the Regular expression search mode checked, of course !

          Notes :

          • The two round brackets, that have to be matched, must be escaped with a backslash character, in order to be taken literally, as there are special regex characters, which define a group

          • The syntax .*? represents the shortest string of characters, between the two round brackets

          • The other syntax .* would have matched the largest string, between two round brackets. So, it could contain round brackets, itself !

          Best Regards,

          guy038

          1 Reply Last reply Reply Quote 1
          • Claudia FrankC
            Claudia Frank
            last edited by

            oopps, I thought ( ) should remain, but if I reread it clearly states
            Search for 2 character and delete these two character and all between ?

            Cheers
            Claudia

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