Real-time matching highlight, capture group extraction, common regex cheat sheet, 100% client-side
[\w.-]+@[\w.-]+\.\w+
Match standard email format
1[3-9]\d{9}
China mobile phone number
https?://[\w./?=&%-]+
Match HTTP/HTTPS links
(\d{1,3}\.){3}\d{1,3}
IPv4 address
[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]
18-digit Chinese ID
\d{4}-\d{2}-\d{2}
Standard date format
[\u4e00-\u9fa5]+
Match Chinese text
#[0-9a-fA-F]{6}
CSS color value
[1-9]\d{5}
China postal code
[1-9][0-9]{4,11}
5-12 digit QQ number
-?\d+\.?\d*
Number with decimals
<(\w+)[^>]*>.*?</\1>
Match HTML tag pairs
A Regular Expression (Regex) is a text pattern matching tool used for searching, replacing, and extracting content from strings that match specific rules. It is widely used in form validation, log analysis, data cleaning, and web scraping data extraction, making it an essential skill for developers and data analysts.
\d matches digits, \w matches word characters (letters, digits, underscore), \s matches whitespace. matches any character except newline, * zero or more, + one or more, ? zero or one{n} exactly n times, {n,} at least n times, {n,m} n to m times[abc] character set, [^abc] negated set, (a|b) alternation^ start of line, $ end of line, \b word boundary() capturing group, (?:) non-capturing group, (?=) positive lookaheadDifferent programming languages have different regex engines. This tool uses JavaScript's regex engine, which supports most PCRE syntax but lacks some advanced features (e.g., named capture groups have different syntax across languages). If you need to use it in Python/Java/Go, refer to the respective language's documentation.
g (global) finds all matches instead of just the first; i (ignore case) makes /a/i match both A and a; m (multiline) makes ^ and $ match the start and end of each line rather than the entire text; s (dotAll) makes . match newlines; u (unicode) enables Unicode mode.
A capture group is a part of the regex enclosed in parentheses (). The regex engine saves the content matched by each capture group separately. For example, (\\d{4})-(\\d{2})-(\\d{2}) has three capture groups capturing year, month, and day respectively. In replacement operations, you can reference them with $1, $2, $3.
No. This tool runs 100% locally in your browser. All regex matching and text processing happens on your device. No data is uploaded to any server, fully protecting your privacy.
JavaScript: const re = /pattern/gi; text.match(re). Python: import re; re.findall(r'pattern', text). Java: Pattern.compile("pattern").matcher(text). Go: regexp.MustCompile("pattern").FindAllString(text, -1).