Quick Start
Tutorial
Search & Replace
Tools & Languages
Examples
Reference
Regex Tools
grep
PowerGREP
RegexBuddy
RegexMagic
General Applications
EditPad Lite
EditPad Pro
Google Docs
Google Sheets
LibreOffice
Notepad++
Languages & Libraries
Boost
C#
Delphi
F#
GNU (Linux)
Groovy
ICU (Unicode)
Java
JavaScript
.NET
PCRE (C/C++)
PCRE2 (C/C++)
Perl
PHP
POSIX
PowerShell
Python
Python.NET and IronPython
R
RE2
Ruby
std::regex
Tcl
TypeScript
VBScript
Visual Basic 6
Visual Basic (.NET)
wxWidgets
XML Schema
XQuery & XPath
Xojo
XRegExp
Databases
Google BigQuery
MySQL
Oracle
PostgreSQL
More on This Site
Introduction
Regular Expressions Quick Start
Regular Expressions Tutorial
Replacement Strings Tutorial
Applications and Languages
Regular Expressions Examples
Regular Expressions Reference
Replacement Strings Reference
Book Reviews
Printable PDF
About This Site
RSS Feed & Blog
RegexBuddy—The best regex editor and tester for docs developers!

Notepad++ Regular Expressions

Notepad++ is a popular open source text editor for Windows. Its regular expression support is based on Boost. Notepad++ 8.6.6 and later are built with Boost 1.85 or later. The regular expressions tutorial and reference on this website do not mention Notepad++ specifically. What the tutorial and reference say about Boost also applies to Notepad++.

Boost actually supports 6 regex grammars. Notepad++ only uses the default ECMAScript grammar. This is also the grammar that this website is describing when it mentions Boost without mentioning any particular grammar. When grammars are mentioned or listed in the reference tables, only what is said about the ECMAScript grammar or indicated with ECMA in the reference tables applies to Notepad++.

Several commands in Notepad++ such as Search|Find (Ctrl+F) and Search|Replace (Ctrl+H) pop up a tabbed dialog box that is shared by these commands. All tabs have a “regular expression” radio button. Activate that to make Notepad++ interpret what you enter in the “find what” box as a regular expression.

By default, regular expressions in Notepad++ are case insensitive. You can make them case sensitive by ticking the “match case” checkbox. The “. matches newline” checkbox controls whether or not the dot matches characters that the Boost regex engine treats as line breaks. This includes the newline character but also the carriage return, form feed, next line, line separator, and paragraph separator characters. This is basically all characters treated as line breaks by Unicode except the vertical tab, which the dot always matches. The caret and dollar always match at the start and end of each line, which is also the default in Boost.

The “backward direction” and “match whole word only” checkboxes are grayed out in regular expression mode. Boost’s regex engine cannot search backwards. Matching a regex as a whole word can be done by adding word boundaries: \bregex\b.

On the Replace tab, you can enter a replacement string in the “replace with” box. Notepad++ uses Boost’s “all” replacement string format. This differs from Boost’s default replacement string format by enabling replacement string conditionals. Boost recognizes both \1 and $1 as backreferences in the replacement text. A backslash escapes the next character.

Though Notepad++ leaves the “swap find and replace” button enabled in regular expressions mode, this makes no sense. You cannot reverse a regex search-and-replace by swapping the regex and the replacement. If you make a mistake, use the Undo command.

| Quick Start | Tutorial | Search & Replace | Tools & Languages | Examples | Reference |

| grep | PowerGREP | RegexBuddy | RegexMagic |

| EditPad Lite | EditPad Pro | Google Docs | Google Sheets | LibreOffice | Notepad++ |

| Boost | C# | Delphi | F# | GNU (Linux) | Groovy | ICU (Unicode) | Java | JavaScript | .NET | PCRE (C/C++) | PCRE2 (C/C++) | Perl | PHP | POSIX | PowerShell | Python | Python.NET and IronPython | R | RE2 | Ruby | std::regex | Tcl | TypeScript | VBScript | Visual Basic 6 | Visual Basic (.NET) | wxWidgets | XML Schema | XQuery & XPath | Xojo | XRegExp |

| Google BigQuery | MySQL | Oracle | PostgreSQL |