What regular expression is used to delete everything except the first word from each line:
Data:
JAMES 3.318 3.318 1
JOHN 3.271 6.589 2
ROBERT 3.143 9.732 3
I’m trying to do this in Notepad++ as a replace.
Depends on what regex implementation you’re using.
the regex
^[A-Za-z_]+will capture the first word on a line. So, you can capture this first word and print it out and you’re good to go, if your implementation permits.If you need to use substitute, you can substitute
^([A-Za-z_]+).*for\1E.g., in vi, you would use the command
:%s/^\([A-Za-z_]+\).*/\1/