Select all IP addresses in Sublime Text

How to select all IP addresses in Sublime Text

Regex to select all IP addresses in Sublime Text

  • Open the file containing the IP addresses in SublimeText and go to Find - Replace....

  • Make sure you have the RegEx selector enabled - it looks like a .* sign next to the search field.

  • For IP addresses that look like this: 99.7.83.38 enter the following regex: \b(\d{1,3}\.){3}\d{1,3}\b.

  • For IP addresses that look like this: 99.61.204.91/32 enter the following regex: \b(\d{1,3}\.){3}\d{1,3}\/\d+\b

  • Then click the Find All button (on the right) and copy them into a single blacklist of IP addresses.

  • After that you can leave only unique values. To do this, open the menu Edit - Permute Lines - Unique. Depending on the length of the list it may take a few seconds or minutes.

  • Save the file and use it for your needs.

PS. This answer about choosing IP addresses is also good.

Last updated