.Any character
CharacterMatches any character except a newline in most regular expression engines.
Example
a.cMatches
abc, a-c, a7c
Development reference
Search regular expression syntax, character classes, groups, quantifiers, anchors and practical patterns.
34 entries
.Matches any character except a newline in most regular expression engines.
Example
a.cMatches
abc, a-c, a7c
\dMatches a decimal digit. Commonly equivalent to [0-9].
Example
\d+Matches
42 in Order 42
\DMatches any character that is not a decimal digit.
Example
\D+Matches
Order in Order 42
\wMatches letters, digits and underscore in common JavaScript regular expressions.
Example
\w+Matches
user_42
\WMatches a character that is not a letter, digit or underscore.
Example
\W+Matches
@- in user@-name
\sMatches whitespace such as spaces, tabs and line breaks.
Example
hello\sworldMatches
hello world
[abc]Matches one character contained in the set.
Example
[aeiou]Matches
Vowels in developer
[^abc]Matches one character not contained in the set.
Example
[^0-9]Matches
Any non-digit character
[a-z]Matches one character inside the specified range.
Example
[A-Fa-f0-9]Matches
A hexadecimal character
*Matches the previous token zero or more times.
Example
ab*cMatches
ac, abc, abbbc
+Matches the previous token one or more times.
Example
ab+cMatches
abc, abbbc
?Makes the previous token optional.
Example
colou?rMatches
color, colour
{n}Matches the previous token exactly n times.
Example
\d{4}Matches
2026
{n,m}Matches the previous token between n and m times.
Example
\w{3,10}Matches
Words from 3 to 10 characters
*?Matches as few repetitions as possible.
Example
<.*?>Matches
One HTML-like tag at a time
^Matches the beginning of the input, or a line with multiline mode.
Example
^ErrorMatches
A line beginning with Error
$Matches the end of the input, or a line with multiline mode.
Example
done$Matches
A line ending with done
\bMatches the boundary between a word character and a non-word character.
Example
\bcat\bMatches
cat but not concatenate
(abc)Groups tokens and captures the matched text.
Example
(\d{4})-(\d{2})-(\d{2})Matches
2026-07-15
(?:abc)Groups tokens without creating a captured result.
Example
(?:https?)://Matches
http:// or https://
a|bMatches either the expression on the left or the expression on the right.
Example
cat|dogMatches
cat or dog
\1Matches the same text captured by an earlier group.
Example
\b(\w+)\s+\1\bMatches
Repeated words such as the the
(?=abc)Requires the following text to match without consuming it.
Example
\d+(?=px)Matches
24 in 24px
(?!abc)Requires the following text not to match.
Example
foo(?!bar)Matches
foo not followed by bar
(?<=abc)Requires preceding text to match without consuming it.
Example
(?<=\$)\d+Matches
42 in $42
gFinds all matches instead of stopping after the first one.
Example
/cat/gMatches
Every occurrence of cat
iIgnores letter casing while matching.
Example
/hello/iMatches
hello, Hello, HELLO
mMakes start and end anchors work for individual lines.
Example
/^error/gmMatches
Lines beginning with error
sAllows the dot token to match line terminators.
Example
/start.*end/sMatches
Text spanning multiple lines
uEnables Unicode-aware regular expression behavior.
Example
/\p{Letter}+/uMatches
Unicode letter sequences
EmailMatches many conventional email addresses without attempting full RFC validation.
Example
^[^\s@]+@[^\s@]+\.[^\s@]+$Matches
IPv4Matches four dot-separated groups of one to three digits.
Example
^(?:\d{1,3}\.){3}\d{1,3}$Matches
192.168.1.1
Hex colorMatches three-digit or six-digit hexadecimal CSS colors.
Example
^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$Matches
#fff, #1a2b3c
SlugMatches lowercase words separated by single hyphens.
Example
^[a-z0-9]+(?:-[a-z0-9]+)*$Matches
regex-cheat-sheet
Related tool
Use Regex Tester to try expressions against sample text, inspect matches and experiment with flags.
Open Regex Tester