• Login
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.
  • S
    Steen Frank Mikkelsen
    last edited by Dec 20, 2015, 2:51 PM

    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)

    C 1 Reply Last reply Dec 20, 2015, 6:30 PM Reply Quote 0
    • C
      Claudia Frank @Steen Frank Mikkelsen
      last edited by Dec 20, 2015, 6:30 PM

      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
      • G
        guy038
        last edited by guy038 Dec 21, 2015, 2:47 AM Dec 21, 2015, 2:19 AM

        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
        • C
          Claudia Frank
          last edited by Dec 21, 2015, 2:32 AM

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