How to leave only five-digit numbers in lines in Notepad++
- Open Notepad++ and load the file in which you need to leave only five-digit numbers.
- Go to the Search menu and select Replace.
- In the opened window, enable the Search Mode option and select Regular expression.
- In the Find field, enter the regular expression:
.*?(\b\d{5}\b).*?(\R|$)
\1\2
Search and replace
- To search for all elements matching the regular expression, click the Find All in Current Document button.
- To replace all found elements, click the Replace All button.
Example
- Suppose we have the text:
12345 abc 67890 def 123 4567 89123
- After running the code, we will get a text where only five-digit numbers remain:
12345 67890 89123
With the correct regular expression, you can leave only five-digit numbers in the lines, keeping their placement by lines.