Skip to main content
Skip table of contents

Syntax

Metacharacters

^Beginning of a string
$End of a string
.Match any character (except newline) when used outside of a character set
*Match 0 or more times
+Match 1 or more times
?Match 0 or 1 times
|Alternation
( )Grouping; "storing"
[ ]Character set
{ }Repetition modifier
\Quote or special
NoteTo present a metacharacter as a data character standing for itself, precede it with a backslash '\'.

For example, \. will match the full stop character '.'

Repetitions

a*0 or more 'a'
a+1 or more 'a'
a?0 or 1 'a' (i.e., optional 'a')
a{m}exactly m 'a'
a{m, }at least m 'a'
a{m, n}at least m but at most n 'a'
expr?shortest match taken from the repetition expression expr (i.e., a*?)
NoteBy default it will find the longest match. Use the expr? to find the shortest match.

Single characters

\ttab
\nnewline
\rreturn (CR)
\xhhcharacter with hexadecimal code hh

Zero-width assertions

\b"word" boundary
\Bnot a "word" boundary

Matching

\wmatches any single character classified as a "word" character (alphanumeric or '_')
\Wmatches any non-"word" character
\smatches any whitespace character (space, tab, newline)
\Smatches any non-whitespace character
\dmatches any digit character (equivalent to [0-9])
\Dmatches any non-digit character

Character sets

[characters]Matches any of the characters in the sequence
[x-y]Matches any of the characters from x to y (inclusively)
[\-]Matches the hyphen character '-'
[\n]Matches the newline character
[^expr]Matches any characters except those specified in the expression expr
NoteOther single character denotations with the backslash '\' apply normally too.

Character and equivalence classes

Character and equivalence classes can only be used in Character sets and use the following syntax:

[:class:]Will match any characters from the specified class
Where class can be any of the character class names
[=name=]Will match the base character from the specified character or symbolic name.
Where name can be any character or it's symbolic name
NoteA base character is a character that ignores case, any accents or unique regional tailoring.
Example[[:digit:]] will match any digit character.
[[=a=]] will match a, à, á, â, ã, ä, å, A, À, Á, Â, Ã, Ä and Å.

Operator precedence

1[==] [::]Collation-related bracket symbols
2\Escaped characters
3[ ]Character set (bracket expression)
4( )Grouping
5* + ? {m,n}Repetitions
6
Concatenation
7^ $Anchoring
8|Alternation
NotePerl regular expression syntax is used in all products.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.