'Replacing numbers with asterisks
I want to replace multiple numbers with asterisks with Notepad++, how to? Example:
109.169.76.0/22
109.169.88.0/21
109.190.0.0/16
109.196.166.0/23
109.196.172.0/24
109.196.175.0/24
109.200.30.0/23
109.200.192.0/21
109.200.208.0/20
109.201.133.22/32
109.201.133.24/32
202.55.45.41/32
should become:
109.169.***.***
109.169.***.***
109.190.***.***
109.196.***.***
109.196.***.***
109.196.***.***
109.200.***.***
109.200.***.***
109.200.***.***
109.201.***.***
109.201.***.***
202.55.***.***
(Sorry if I didn't describe it clearly, but I want to replace anything after "NNN.NNN" with "***.***" (N is number)
Thanks :)
Solution 1:[1]
- Ctrl+H
- Find what:
\d+\.\d+/\d+$ - Replace with:
***.*** - CHECK Wrap around
- CHECK Regular expression
- Replace all
Explanation:
\d+ # 1 or more digits
\. # a dot
\d+ # 1 or more digits
/ # a slash
\d+ # 1 or more digits
$ # end of line
Screenshot (before):
Screenshot (after):
Solution 2:[2]
If this is not too long to edit and it has the same amount of characters per line, you can do this using multiple cursors.
If the data you have follows a predictable pattern, then you can use that to replace everything after a specific character. This is shown here, alongside other helpful ways to edit or replace text.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Toto |
| Solution 2 | Lae |


