Quick Start
Tutorial
Tools & Languages
Examples
Reference
Book Reviews
Regex Reference
Introduction
Table of Contents
Quick Reference
Characters
Basic Features
Character Classes
Shorthands
Anchors
Word Boundaries
Quantifiers
Unicode
Capturing Groups & Backreferences
Named Groups & Backreferences
Special Groups
Mode Modifiers
Recursion & Balancing Groups
Replacement Reference
Characters
Matched Text & Backreferences
Context & Case Conversion
Conditionals
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—Better than a regular expression reference!

Regular Expression Reference: Basic Features

FeatureSyntaxDescriptionExampleJGsoft.NETJavaPerlPCREPCRE2PHPDelphiRJavaScriptVBScriptXRegExpPythonRubystd::regexBoostTcl AREPOSIX BREPOSIX EREGNU BREGNU EREOracleXMLXPath
Dot. (dot)Matches any single character except line break characters. Most regex flavors have an option to make the dot match line break characters too.. matches x or (almost) any other characterYESYES
Not a line break\NMatches any single character except line break characters, like the dot, but is not affected by any options that make the dot match all characters including line breaks.\N matches x or any other character that is not a line breakV2nonononononononononononononononono
Alternation| (pipe)Causes the regex engine to match either the part on the left side, or the part on the right side. Can be strung together into a series of alternatives.abc|def|xyz matches abc, def or xyzYESYESnono
Alternation\| (backslash pipe)Causes the regex engine to match either the part on the left side, or the part on the right side. Can be strung together into a series of alternatives.abc\|def\|xyz matches abc, def or xyznonononononononononononononononononononononono
AlternationLiteral line feed not inside a group or character classCauses the regex engine to match either the part on the left side, or the part on the right side. Can be strung together into a series of alternatives.abc
def
xyz
matches abc, def or xyz
nononononononononononononononononononononono
AlternationLiteral line feed inside a group but not inside a character classCauses the group to match either the part on the left side, or the part on the right side. Can be strung together into a series of alternatives.a(bc
de
fg)h
matches abch, adeh or afgh
nonononononononononononononononononononononono
Alternation is eager| or \|Alternation returns the first alternative that matches.a|ab matches a in abYESYESnon/anonono
Alternation is greedy| or \|Alternation returns the longest alternative that matches.a|ab matches ab in abnonononononononononononononon/anonono
FeatureSyntaxDescriptionExampleJGsoft.NETJavaPerlPCREPCRE2PHPDelphiRJavaScriptVBScriptXRegExpPythonRubystd::regexBoostTcl AREPOSIX BREPOSIX EREGNU BREGNU EREOracleXMLXPath