Reputation: 67
I have a textfile contains lines with below:
IP Ports
1.160.0.224 8080
1.160.1.49 8080
1.160.1.70 8080
1.160.1.170 8080
1.160.1.239 8080
I want to use notepad++ regex to remove all empty space and just leave the IP:PORT.
For example below:
1.160.0.224:8080
1.160.1.49:8080
1.160.1.70:8080
1.160.1.170:8080
1.160.1.239:8080
Upvotes: 1
Views: 18920
Reputation: 521239
Find:
(\d)\s+(\d+)\s+
Replace:
$1:$2\r\n
This solution takes into account that you may have a header at the top of your table which you don't want modified during the replacement. It also takes into account that your original data appears to have extra whitespace after the port number 8080
.
Here is a screen capture showing you what your find/replace window should look like:
Upvotes: 2
Reputation: 4476
You can use \s+
to match one or more whitespace, to use notepad++, you can replace based on the "regular expression", but you still need to manually replace by "Find Next" and "Replace" one by one to choose where you want to repalce.
Upvotes: 2
Reputation: 1812
I don't know the Notepad++ UI, but your pattern should be *
(a space followed by *
), and you replacement should be :
Upvotes: 1