Quick Start
Tutorial
Tools & Languages
Examples
Reference
Book Reviews
RegexBuddy Instantly and accurately analyze and test any regular expression with RegexBuddy. Save yourself the headache of figuring out the differences between regex flavors. RegexBuddy knows all the regex features and regex flavors listed in this reference. RegexBuddy also explains and emulates many more subtle differences and idiosyncrasies that are omitted here to keep this reference readable. Get your own copy of RegexBuddy now

Regular Expressions Reference

The regular expressions reference on this website functions both as a reference to all available regex syntax and as a comparison of the features supported by the regular expression flavors discussed in the tutorial. The reference tables pack an incredible amount of information. To get the most out of them, follow this legend to learn how to read them.

The tables have six columns for each regular expression feature. The first four explain the feature.

FeatureThe name of the feature, which also servers as a link to the relevant section in the tutorial.
SyntaxThe actual regex syntax for this feature. If the syntax is fixed, it is simply shown as such. If the syntax has variable elements, the syntax is described.
DescriptionSummary of what the feature does.
ExampleFunctional regular expression that demonstrates the feature.

The final two columns indicate whether your two chosen regular expression flavors support this particular feature. You can change the flavors using the drop-down lists above the table. There are many possible indicators.

YESAll versions of this flavor support this feature.
3.0Version 3.0 and all later versions of this flavor support this feature. Earlier versions do not support it.
2.0 onlyOnly version 2.0 supports this feature. Earlier and later versions do not support it.
2.0–2.9Only versions 2.0 through 2.9 supports this feature. Earlier and later versions do not support it.
UnicodeThis feature works with Unicode characters in all versions of this flavor.
code pageThis feature works with the characters in the active code page in all versions of this flavor.
ASCIIThis feature works with ASCII characters only in all versions of this flavor.
3.0 UnicodeThis feature works with Unicode characters in versions 3.0 and later of this flavor. Earlier versions do not support it at all.
3.0 Unicode
2.0 ASCII
This feature works with Unicode characters in versions 3.0 and later this flavor. It works with ASCII characters in versions 2.0 through 2.9. Earlier versions do not support it at all.
3.0 Unicode
2.0 code page
This feature works with Unicode characters in versions 3.0 and later this flavor. It works with the characters in the active code page in versions 2.0 through 2.9. Earlier versions do not support it at all.
stringThe regex flavor does not support this syntax. But string literals in the programming language that this regex flavor is normally used with do support this syntax.
3.0
1.0 string
Version 3.0 and later of this regex flavor support this syntax. Earlier versions of the regex flavor do not support this syntax. But string literals in the programming language that this regex flavor is normally used with have supported this syntax since version 1.0.
optionAll versions of this regex flavor support this feature if you set a particular option or precede it with a particular mode modifier.
option
3.0
Version 3.0 and all later versions of this regex flavor support this feature if you set a particular option or precede it with a particular mode modifier. Earlier versions either do not support the syntax at all or do not support the mode modifier to change the behavior of the syntax to what the feature describes.
noNo version of this flavor support this feature. No indication is given as to what this syntax actually does. The same syntax may be used for a different feature which is indicated elsewhere in the reference table. Or the syntax may trigger an error or it may be interpreted as plain text.
n/aThis feature is not applicable to this regex flavor. Features that describe the behavior of certain syntax introduced earlier in the reference table show n/a for flavors that do not support that syntax at all.
failThe syntax is recognized by the flavor and regular expressions using it will work, but this particular regex token will always fail to match. The regex will only be able to find matches if this token is made optional by alternation or a quantifier.
ignoredThe syntax is recognized by the flavor but it does not do anything useful. This particular regex token will always find a zero-length match.
errorThe syntax is recognized by the flavor but it is treated as a syntax error.

When this legend says "all versions" or "no version", that means all or none of the versions of each flavor that are covered by the reference tables:

JGsoftEditPad Pro 6 and 7, PowerGREP 3 and 4, AceText 3
.NET1.0–4.5
Java4–8
Perl5.8–5.20
PCRE4.0–8.35
PHP5.0.0–5.6.1
DelphiXE–XE7; TRegEx only; also applies to C++Builder XE–XE7
R2.14.0–3.1.1
JavaScriptECMA-262 v3
VBScriptIE 5.5 implementation of JavaScript
XRegExp2.0.0
Python2.4–3.4
Ruby1.8–2.1
std::regexVisual C++ 2008–2013
Tcl ARE8.4–8.6
POSIX BREIEEE Std 1003.1
POSIX EREIEEE Std 1003.1
GNU BRE
GNU ERE
Oracle10gR1, 10gR2, 11gR1, 11gR2, 12c
XML1.0–1.1
XPath2.0

For the std::regex flavor there are additional indicators ECMA, basic, extended, grep, egrep, and awk. When one or more of these appear, that means that the feature is only supported if you specify one of these grammars when compiling your regular expression. Features with Unicode indicators will match Unicode characters when using std::wregex on wide character strings.

Make a Donation

Did this website just save you a trip to the bookstore? Please make a donation to support this site, and you'll get a lifetime of advertisement-free access to this site! Credit cards, PayPal, and Bitcoin gladly accepted.

Regex Reference
Introduction
Table of Contents
Quick Reference
Characters
Basic Features
Character Classes
Anchors
Word Boundaries
Quantifiers
Unicode
Capturing Groups & Backreferences
Named Groups & Backreferences
Special Groups
Recursion & Balancing Groups
Replacement Reference
Characters
Matched Text & Backreferences
Context & Case Conversion
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