Skip to content

Keep Regex only matches in Notepad++ (Npp plugin)

I’ve developed a Notepad++ plugin that adds the option to keep only regex patterns in a text file.

When working with large text files and wanting to extract specific data from them, such as log files or data files, it’s convenient to be able to filter out everything in one click.

Filter everything but regex from text file
Match Regex pattern only in notepad++

With this plugin, it’s easy to filter out everything that doesn’t match the pattern. Just fill out the “Regex Pattern” field and click on “Keep Pattern”. After that, only the selected pattern is left.

Download the plugin RegexOnly

Filter all IP addresses from a text file with Regex in notepad++

To clear a log file from anything but IP addresses, just input this regex pattern and click “Keep Pattern” [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} (Updated to \. in the pattern, thanks to daniel.krause777 )

This pattern matches every string that has the structure of an IP address.

Keep all the words containing a specific letter or letters with Regex in notepad++

If you want to keep only words that contain specific characters you can use this pattern  \w*(c)\w*, it will keep only words that include the lower cased letter ‘c’. If you want both lowercase and uppercase you can use this pattern \w*(c|C)\w*

The thing I absolutely love about working with regex is its versatility. Almost everything can be solved, when using the correct pattern and the right tools.

Hope you like this plugin, you can let me know in the comments below if you have any improvements and other ideas.

1 comment

  1. Hi, thanks for that! But it should be [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} instead of [0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3} 😉

Leave a Reply