只保留记事本++中每行的第一个单词

And*_*ndy -1 regex notepad++

例如我有:

hello I am ...
For the reason ...
Not sure if ...
Run Code Online (Sandbox Code Playgroud)

我想保留helloForNot摆脱记事本++中每一行中的其余部分。

Tim*_*sen 5

找:

^([^\s]*)\s.*$
Run Code Online (Sandbox Code Playgroud)

代替:

\1
Run Code Online (Sandbox Code Playgroud)

解释:

^          start of line
([^\s]*)  match and capture every non whitespace character up until
\s         the first whitespace character
.*         consume remainder of line until reaching the
$          end of line
Run Code Online (Sandbox Code Playgroud)