Regex Cheatsheet

Mabilisang sanggunian para sa mga regular expression na may interactive na match highlighting

Lahat ng proseso ay nangyayari sa iyong browser. Walang data na ina-upload.
Offline Ready

Regex Cheatsheet

Mabilisang sanggunian para sa mga regular expression na may interactive na match highlighting

🔒Lahat ng proseso ay nangyayari sa iyong browser. Walang data na ina-upload.
Maghanap ng mga pattern, paglalarawan...
Lahat
Character Classes
Quantifiers
Anchors
Groups
Assertions
Flags
Character Classes
10
.
Any character except newline
h.t
\d
Digit (0-9)
\d{3}
\D
Non-digit
\D+
\w
Word character (a-z, A-Z, 0-9, _)
\w+
\W
Non-word character
\W
\s
Whitespace (space, tab, newline)
\s+
\S
Non-whitespace character
\S+
[abc]
Any character in the set
[aeiou]
[^abc]
Any character NOT in the set
[^aeiou]
[a-z]
Any character in the range
[a-f]
Quantifiers
8
*
Zero or more
go*d
+
One or more
go+d
?
Zero or one (optional)
colou?r
{n}
Exactly n times
\d{4}
{n,}
n or more times
\d{2,}
{n,m}
Between n and m times
\d{2,4}
*?
Zero or more (lazy)
<.*?>
+?
One or more (lazy)
\w+?
Anchors
4
^
Start of string (or line in multiline)
^Hello
$
End of string (or line in multiline)
world$
\b
Word boundary
\bcat\b
\B
Non-word boundary
\Bcat
Groups
5
(abc)
Capturing group
(ha)+
(?:abc)
Non-capturing group
(?:ha)+
(?<name>abc)
Named capturing group
(?<year>\d{4})
\1
Backreference to group 1
(\w+)\s\1
(a|b)
Alternation (a or b)
(cat|dog)
Assertions
4
(?=abc)
Positive lookahead
\w+(?=\s)
(?!abc)
Negative lookahead
\d+(?!\$)
(?<=abc)
Positive lookbehind
(?<=\$)\d+
(?<!abc)
Negative lookbehind
(?<!\$)\d+
Flags
6
g
Global - find all matches
/cat/g
i
Case-insensitive matching
/hello/i
m
Multiline - ^ and $ match line boundaries
/^foo/m
s
Dotall - dot matches newline too
/a.b/s
u
Unicode - enable full Unicode support
/\p{L}/u
y
Sticky - match from lastIndex only
/\d+/y