Find and replace everything between and including parentheses



  • I’m having some trouble with find and replace. I want to find and replace everything between and including parentheses. I have many instances of dollar amounts in between parentheses that I want to get rid of. I also have words between parentheses that I want to get rid of. Example: ($76,800), (N/A)

    I select Search > Replace. In “Find What” I put:
    ( .+)

    In “Replace With” I put nothing.

    I click “Replace All”. Notepad++ tells me that 0 occurrences were found. What am I doing wrong please?



  • Parenthesis have special meaning to regular expressions. You need to escape them (by putting \ in front of them). So your regex would look like:

    \(.+\)
    

    Also, for safety you probably want to do lazy matching:

    \(.+?\)


  • @dail said:

    (.+?)

    Genius! Thank you!


Log in to reply