FAQ: Where to find REGular EXpressions (RegEx) documentation ?
-
IMPORTANT : updated on
February 28, 2025
: I modified the last part of this post, after the REMARK point. I deleted the part relative to the old N++v.6.9.0
release and replaced it with the new release of the N++Columns++
plugin of @Coises.Hello and welcome to the FAQ Desk. You have likely been directed here because you asked about N++ regex flavor, [ N++ ] regex documentation or N++ regex enhancements.
PRELIMINARY note : As recalled recently by @peterjones, our forum is not a professional regex-writing forum. We are users of Notepad++, who want to help others learn more about NPP (and learn more ourselves, in the process). Since Notepad++ makes use of regular expressions, we will often provide help with regex questions.
Our present regex engine is implemented since Ascii and Unicode version
6.0
of Notepad++ and improved till thev6.4.2
version, by, both, Dave BrotherStone and François-R Boyer. Previously, It used the Regex library, of the Boost C++ librariesv1.55.0
, similar to the PERL Regular Common Expressionsv5.8
.Starting with Notepad++
v7.7
, it currently used the Boost C++ regex libraryv1.70.0
. Since this release, the Backtracking Control Verbs are supported. Refer to the link, below, for information on this new feature :https://community.notepad-plus-plus.org/post/55464
Finally, since Notepad++
v8.2
, the current Boost C++ regex library is the releasev1.78.0
.
For noob people, about regular expressions concept and syntax, begin with that article, elaborated by Peter Jones and part of the Notepad++ Documentation :
https://npp-user-manual.org/docs/searching/#regular-expressions
Note that the old link of the outdated Notepad++ Wiki ( http://docs.notepad-plus-plus.org/index.php/Regular_Expressions ) as well as the temporary link, on GitHub ( http://notepad-plus-plus.github.io/npp-usermanual/content/searching/ ) are, from now on, obsolete
In addition, whatever its level, anyone will find good documentation, about the regex library; of the Boost C++ libraries
v1.70.0
, from the two addresses below :http://www.boost.org/doc/libs/1_78_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html
http://www.boost.org/doc/libs/1_78_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html
-
The FIRST link explains the syntax, of regular expressions, in the SEARCH part.
-
The SECOND link explains the syntax, of regular expressions, in the REPLACEMENT part.
And, possibly, take a glance at the Standards Conformance :
https://www.boost.org/doc/libs/1_78_0/libs/regex/doc/html/boost_regex/background/standards.html
You may, also, look for valuable information, on this non-exhaustive list of sites, below :
General Information
:
https://en.wikipedia.org/wiki/Regular_expression
Summary of Regex Syntax
( Cheat Sheet and Basic Features ) :
https://www.regular-expressions.info/quickstart.html
http://www.rexegg.com/regex-quickstart.html
https://regex101.com/ — Quick Reference panel ( Thanks to Jim Dailey )
https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285
https://ryanstutorials.net/regular-expressions-tutorial/ — Excellent introduction
https://www.geeksforgeeks.org/write-regular-expressions/
https://docs.python.org/2/howto/regex.html
https://www.debuggex.com/cheatsheet/regex/pcre
http://regexstorm.net/reference
Full Documentation and Advanced Information
:
http://www.regular-expressions.info ( the REFERENCE ! )
https://gammon.com.au/pcre/pcrepattern.html
http://perldoc.perl.org/perlre.html
https://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean
Regex Testers
:
https://www.regexbuddy.com — All flavors ( the REFERENCE ! )
https://regex101.com/ — PCRE , Python, JavaScript and Golang flavors
https://regexone.com/ — PCRE flavor
https://www.debuggex.com/ — JavaScript, Python and PCRE flavors ( Visual regex representation )
https://www.regextester.com/ — JavaScript and PCRE flavors
https://www.regexpal.com/ — JavaScript and PCRE flavors
https://www.freeformatter.com/regex-tester.html — JavaScript flavor
https://regexr.com/ — .NET flavor
Be aware that, as any documentation, it may contain some errors ! Anyway, if you’ve detected one, that’s good news : you’re improving ;-))
I highly recommend reading the contents of the third edition of the book Mastering Regular Expressions ( Understand your Data and Be More Productive ) by Jeffrey E. F. Friedl ( August 2006 ). If you find it of interest, just download this PDF file, of
542
pages.Refer for an English version ( ISBN
0-596-52812-4
) from the link, below :And click, on your right, on the button
Download raw file
in order to download thePDF
file.
Quotations :
Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now, they have two problems! — Jamie Zawinski
And, of course, one claimed precedence. One said: “I needed love, I got married. Then, I had two problems”! — Anonymous
REMARK :
After some practice, you will probably find out some unexpected results with our present N++ regex engine :
-
It does not completely handle the characters over the
BMP
, due to the present management ofUTF-16
code units. -
And thus, you can only access the characters over the
BMP
with the surrogate pairs (\x{D8..}\x{D...}
) mechanism, instead of the classical\x{#####}
or\x{######}
notation. -
The management of accentuated characters and the
NUL
character, in replacement, does not work.
Now, starting with the N++ release
v8.7.8
, you’ll be able to use an enhanced version of ourBoost
regex engine ( Big thanks to @Coises !! ) which corrects some bugs and adds a lot of regex improvements.Refer to the following links :
https://community.notepad-plus-plus.org/topic/26659/columns-version-1-2-better-unicode-search
https://github.com/Coises/ColumnsPlusPlus/releases/tag/v1.2
It is important to emphasize that the Find and Replace option of the
Columns++
plugin does not replace the native N++ Find and Replace dialog, in many ways :-
This plugin cannot search ( and replace ) in all opened files or the current N++ session
-
This plugin cannot search ( and replace ) in all files, with specific(s) extension(s) of a tree structure
However, in return :
-
This plugin allows search ( and replace ) in one or more
rectangular
selections and the^
and$
assertions match at beginning and end of each selection row ! -
This plugin allows
mathemathical
formulas in replacements !
Here are two links to the on line help about the Search and Regular Expressions sections to clarify when
Columns++
might be useful.However, take a tour of
Columns++
's powerful features !!Now, to give it a try, install the
ColumnsPlusPlus
plugin from the N++ optionPlugins > Plugins Admin...
, and, then, select the N++ optionPlugins > Columns++ > Search...
Regarding the whole documentation, run the
Plugins > Columns++ > Help/About... > —> Help
option
The main improvements of this enhanced
BOOST
regex engine are :-
Search and replacement are both performed in true
32 bits
code-points. -
So, it can handle ALL the Universal Character Names ( UCN) of the UCS Transformation Format , from
\x{0}
to\x{7FFFFFFF}
, particularly, all those of code-points over\x{FFFF}
, which are outside the BMP ( Basic Multilingual Plane ). -
Both, search and replace strings can contain embedded NUL characters and/or Escape sequences for NUL characters (
\x{0000}
). -
Backward assertions, as
\A
, are correctly supported ( OK with N++ sincev7.9.1
). -
Look-behinds are correctly handled, when searching or replacing, even those overlapping with the end of the previous match ( OK with N++ since
v7.9.1
). -
The management of
accentuated
characters, when case replacement, works as expected. -
All
POSIX
characters classes as well as some single letter classes and the[[unicode:]]
class work correctly. Refer to the link :
- All
Unicode
character classes work correctly, with the exception of the\p{Cs}
and\p{Surrogate}
classes. Refer to the link :
Important note :
The classes of characters, sensible to the case, will always return case-sensitive results, even if the
Match case
option is not checked or a(?i)
modifier is used !-
Some
escape
sequences have been added :-
\o
forASCII
code-points, between0
and127
. -
\y
or[[defined:]]
for defined characters, except for the threeUnassigned
,Invalid
andPrivate use
characters. -
\i
or[[invalid:]]
for INVALIDUTF-8
bytes or sequences.
-
-
All
Control
andNon-printing
character abbreviations can be found, independently, with the Symbolic character name[[.XXX.]]
( e.g.[[.NBSP.]]
would find all theNon Breaking Space
characters ). -
The
\X
feature has been improved and reliably matches agrapheme cluster
, so an usual single character, regardless of how many Unicode code-points are necessary to compose this character ! ( It’s, for example, the case of a base letter with subsequentaccentuated
characters or of someEmoji
sequences in order to build combined emojis ) -
The
\K
feature ALSO works in a step-by-step replacement with the use of theReplace
button
Finally,
Columns++
plugin shows a process dialog when the estimated time, for multipleCount
,Select
orReplace
actions, exceeds two seconds !REMARK : Although the improvements made to Columns++ plugin mainly concern Unicode handling, this plugin works perfectly well with
ANSI
files, too !Now…, just enjoy any complicated regex in search/replacement !!
-
-
Additional Regex Tester tool (offline): RegEx Tester
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
G guy038 referenced this topic on
-
G guy038 referenced this topic on
-
G guy038 referenced this topic on
-
G guy038 referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
G guy038 referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
T Terry R referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
J jeffvb9 referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
L L S referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
G guy038 referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
G gerdb42 referenced this topic on
-
A Alan Kilborn referenced this topic on
-
I Infinite referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
O Olivier Chantraine referenced this topic on
-
P PeterJones referenced this topic on
-
L Lycan Thrope referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
F faouzi sat referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
T Terry R referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
L Lycan Thrope referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
L Lycan Thrope referenced this topic on
-
P PeterJones referenced this topic on
-
G gerdb42 referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
A Alan Kilborn referenced this topic on
-
D Danek Szczepan referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
G guy038 referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
T Terry R referenced this topic on
-
T Terry R referenced this topic on
-
M mkupper referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
G gerdb42 referenced this topic on
-
G gerdb42 referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
L Lycan Thrope referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
A Alan Kilborn referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
T Terry R referenced this topic on
-
P PeterJones referenced this topic on
-
T Terry R referenced this topic on
-
P PeterJones referenced this topic on
-
T Terry R referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
T Terry R referenced this topic on
-
P PeterJones referenced this topic on
-
P PeterJones referenced this topic on
-
M Mark Olson referenced this topic on
-
P PeterJones referenced this topic on
-
G guy038 referenced this topic on