Bảng tóm tắt Regex

Hướng dẫn tham khảo nhanh cho biểu thức chính quy với đánh dấu kết quả khớp tương tác

Mọi xử lý diễn ra trong trình duyệt của bạn. Không có dữ liệu nào được tải lên.
Offline Ready

Bảng tóm tắt Regex

Hướng dẫn tham khảo nhanh cho biểu thức chính quy với đánh dấu kết quả khớp tương tác

🔒Mọi xử lý diễn ra trong trình duyệt của bạn. Không có dữ liệu nào được tải lên.
Tìm mẫu, mô tả...
Tất cả
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