Công cụ Developer
Tài liệu Regex
Tài liệu tham khảo biểu thức chính quy tương tác với trình kiểm tra trực tiếp — anchors, character classes, quantifiers, groups, lookaheads, flags và các mẫu phổ biến
Được tin dùng bởi hơn 10k developer
Live Regex Tester
//
Hello World 123
1 match"123" @12
Anchors
Start of string (or line with m flag)
e.g. ^Hello
End of string (or line with m flag)
e.g. world$
Word boundary
e.g. \bword\b
Not a word boundary
e.g. \Bend
Start of string (no multiline)
e.g. \AHello
End of string (no multiline)
e.g. world\Z
Character Classes
Any character except newline
e.g. a.c
Word character [a-zA-Z0-9_]
e.g. \w+
Non-word character
e.g. \W+
Digit [0-9]
e.g. \d{3}
Non-digit
e.g. \D+
Whitespace (space, tab, newline)
e.g. \s+
Non-whitespace
e.g. \S+
Any of a, b, or c
e.g. [aeiou]
Not a, b, or c
e.g. [^0-9]
Character in range a to z
e.g. [a-zA-Z]
Chinese characters (Unicode range)
e.g. [\u4e00-\u9fff]+
Quantifiers
0 or more of a (greedy)
e.g. ab*c
1 or more of a (greedy)
e.g. ab+c
0 or 1 of a (optional)
e.g. colou?r
Exactly 3 of a
e.g. \d{4}
3 or more of a
e.g. \w{3,}
Between 3 and 6 of a
e.g. \d{2,4}
0 or more of a (lazy/non-greedy)
e.g. <.*?>
1 or more of a (lazy)
e.g. \d+?
Groups & Capturing
Capture group
e.g. (\d+)-(\w+)
Non-capturing group
e.g. (?:https?)
Named capture group
e.g. (?<year>\d{4})
Backreference to group 1
e.g. (\w+)\s\1
Positive lookahead
e.g. \d(?=px)
Negative lookahead
e.g. \d(?!em)
Positive lookbehind
e.g. (?<=\$)\d+
Negative lookbehind
e.g. (?<!\$)\d+
a or b (alternation)
e.g. cat|dog
Escape Characters
Newline
e.g. line1\nline2
Tab
e.g. col1\tcol2
Carriage return
e.g. \r\n
Literal dot
e.g. \d+\.\d+
Literal asterisk
e.g. \*important\*
Literal parenthesis
e.g. func\(\)
Flags
Global + case-insensitive
e.g. /hello/gi
Multiline (^ and $ match line start/end)
e.g. /^\w+/m
Dotall (. matches newline too)
e.g. /a.b/s
Unicode (enable Unicode support)
e.g. /\p{L}/u
Unicode sets (advanced, ES2024)
e.g. /[\p{Emoji}]/v
Common Patterns
Email address
e.g. user@example.com
HTTP/HTTPS URL
e.g. https://example.com
Phone number (E.164)
e.g. +12345678901
Date (YYYY-MM-DD)
e.g. 2024-04-01
Hex color (without #)
e.g. ff5733
Password: min 8 chars, 1 uppercase, 1 digit
e.g. Password1
IPv4 address (basic)
e.g. 192.168.1.1
URL slug
e.g. my-blog-post
HTML comment
e.g. <!-- comment -->
CSS hex color with #
e.g. #ff5733
IPv4 address (strict-ish)
e.g. 10.0.0.1
Username (3-16 chars)
e.g. user_name-1
Tiếp tục khám phá
Công cụ Công cụ Developer khác bạn có thể thích…
Định dạng JSON
Định dạng, kiểm tra và nén JSON với tô sáng cú pháp và phát hiện lỗi
Dùng ngay
Mã hóa/Giải mã Base64
Mã hóa văn bản hoặc file sang Base64 và giải mã chuỗi Base64 thành văn bản
Dùng ngay
Mã hóa/Giải mã URL
Mã hóa và giải mã thành phần URL và tham số query string
Dùng ngay
Tạo UUID
Tạo UUID ngẫu nhiên (v1, v4) hoặc tạo hàng loạt nhiều UUID cùng lúc
Dùng ngay
Tạo Hash
Tạo hash MD5, SHA-1, SHA-256, SHA-512 từ văn bản hoặc file
Dùng ngay
Kiểm tra Regex
Kiểm tra biểu thức chính quy với tô sáng khớp thời gian thực và trích xuất nhóm
Dùng ngay
Giải mã JWT
Giải mã và kiểm tra JSON Web Token — xem header, payload và xác minh chữ ký
Dùng ngay
Định dạng HTML
Định dạng và làm đẹp mã HTML với thụt lề đúng và tô sáng cú pháp
Dùng ngay