regexnotepad++

How to remove word after ")." line by line?


I have a text and want to remove any word after ).

A).     Buyers of potato
B).     Buyers of egg
C).     Buyers of gasolin
W). The price meat

The desired output would be:

->A).   
->B).   
->C).   
->W). 

I've tried using \).* which doesn't look like a good idea to start with.


Solution

  • When using Notepad++ you can do the following:

    Search for: (^\w+\)\.).*

    Replace by: ->\1

    This captures the desired beginning of the line in the first capture group and outputs it prepended with ->.