Delete word before and after Space

notepadregex

I hope anyone has an solution for my problem.

I have a format likes this:

0500380 Thomas
0800251 Peter
0682006 Martin

I want two solutions:

First:

0500380 
0800251 
0682006 

Delete everything after space

Second:

Thomas
Peter
Martin

Delete everything before space

Best Answer

Delete everything after space

  • Menu "Search" > "Replace" (or CtrlH)

  • Set "Find what" to ^(\w+) (\w+)$

  • Set "Replace with" to \1

  • Enable "Regular expression"

Image


Delete everything before space

  • Menu "Search" > "Replace" (or CtrlH)

  • Set "Find what" to ^(\w+) (\w+)$

  • Set "Replace with" to \2

  • Enable "Regular expression"

Image


Further reading

Related Question