Skip to content

Some tools to use C# Regex in Notepad++ (Plugin) (Search and Replace, Selection, Extraction...)

License

Notifications You must be signed in to change notification settings

codingseb/CSharpRegexTools4Npp

Repository files navigation

CSharpRegexTools4Npp

Some tools to use C# Regex in Notepad++ (As Notepad++ Plugin)

Features

  • Syntax Highlight of the C# Regex
  • List all matches (With groups and captures)
  • Select All matches
  • Replace All matches (with replace syntax or C#)
  • Extract All matches in a new Notepad++ tab
  • Work on current Notepad++ tab text, on current selection or in a directory
  • Named groups, lookbehind, lookforward and all features of C# Regex
  • Keep an history of typed regex
  • Save/Reload Regex

Prerequistes

Need a Notepad++ x86 or x64 installed on the machine and the right to write in the plugin directory. (At least version 7.6.3, older versions can work but need modification of the file NppPlugin.DllExport.targets see Notepad++ plugins new directories structures)

Need .Net Framework 4.7 or greater

Installation

  • Download the last release zip
  • Uncompress it in the "%PROGRAMFILES%\Notepad++\plugins" directory

Or

  • Clone this repo
  • Give write access to "%PROGRAMFILES%\Notepad++\plugins" directory
  • Launch CSharpRegexTools4Npp.sln in Visual Studio
  • Select the target platform x86 or x64 depending on your version of Notepad++
  • Compile and launch (F5) (It will copy the plugin in the right place and launch Notepad++)

Usage

To Launch the tools use one of these 3 methods :

  • Click on the toolbar button ToolbarIcon
  • Click on Menu "Plugins" -> "C# Regex Tools 4 Npp" -> "C# Regex Tools"
  • Press "Ctrl+Shift+H" on your keyboard

Show matches of the Regex

List-Matches-Preview

Use Regex snippets

Use-Regex-Snippets

Replace all occurences

Replace-all-

Replace with C# script

Replace-With-C#

Standards Regex operations from the toolbar

Toolbar-Actions

  1. Is Match ? : Show a "Yes" if at least one match is found in the text source. Show a "No" otherwise
  2. Matches : Fill the list of all found matches with Groups and Captures
  3. Select All Matches : Select all found matches in the current Notepad++ tab (Can be use for multi-edition)
  4. Extract All : Extract all matches results in a new Notepad++ tab
  5. Replace All : Replace all matches in the text source

Some others functionalities (options) preview

Replace-Elements

Replace-Elements

Text-sources

Credits

Based on : NotepadPlusPlusPluginPack (Apache-2.0 license) Merged manually with a part of the version used in CS-Script.Npp (under MIT license) for better x64 support and remodified for the way I use it.
use :
AvalonEdit For Regex edition and syntax Highlighting (MIT license)
CS-Script For C# Match replace (MIT license)
Newtonsoft.Json (MIT license)
Ookii.Dialogs (For Open and Save dialogs specific license)
PropertyChanged.Fody (MIT license)
Costura.fody Merge all in one DLL, without it it doesn't work (MIT license)

And for icons :

FatCow (Creative Commons 3.0)

About

Some tools to use C# Regex in Notepad++ (Plugin) (Search and Replace, Selection, Extraction...)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages