Reference – What does this regex mean?

The Stack Overflow Regular Expressions FAQ

See also a lot of general hints and useful links at the tag details page.


Online tutorials

Quantifiers

Character Classes

Escape Sequences

Anchors

anchor matches flavors
^ Start of string Common*
^ Start of line Commonm
$ End of line Commonm
$ End of text Common*
$ The very end of string D,
\A Start of string Common except
\Z End of text Common except
\Z The very end of string
\z The very end of string Common except
\b Word boundary Common
\B Not a word boundary Common
\G End of previous match Common except , re
Term Definition
Start of string At the very start of the string.
Start of line At the very start of the string, and
after a non-terminal line terminator.
End of string At the very end of the string.
End of text At the very end of the string, and
at a terminal line terminator.
End of line At the very end of the string, and
at a line terminator.
Word boundary At a word character not preceded by a word character, and
at a non-word character not preceded by a non-word character.
End of previous match At a previously set position, usually where a previous match ended.
At the very start of the string if no position was set.

“Common” refers to the following:

* Default |
m Multi-line mode. |
D Dollar end only mode.

Groups

Lookarounds

Modifiers

Other:

Common Tasks

Advanced Regex-Fu

Flavor-Specific Information

(Except for those marked with *, this section contains non-Stack Overflow links.)

General information

(Links marked with * are non-Stack Overflow links.)

Examples of regex that can cause regex engine to fail

Tools: Testers and Explainers

(This section contains non-Stack Overflow links.)

Leave a Comment