Regex Tester
Enter a regular expression and test text to see matches, capture groups and highlighted positions in real time. Everything runs locally in your browser.
What is a Regular Expression?
A regular expression (regex) is a sequence of special characters that describes a text pattern. It is widely used for searching, replacing, validating and extracting data. For example, `\d{4}-\d{2}-\d{2}` matches dates like 2026-08-23, and `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$` validates email addresses. Core building blocks include character classes, quantifiers, groups and assertions; mastering them greatly improves text-processing efficiency.
Common Flags
- g (global): find all matches, not just the first one
- i (ignore case): match without distinguishing case
- m (multiline): ^ and $ match at the start and end of each line
- s (dot matches newline): let . also match newline characters
- u (unicode): treat patterns as Unicode code points, useful for Chinese and emoji
How to Use This Tool
- Type a pattern such as `\b\w+@\w+\.\w+\b` in the expression field
- Select the flags you need
- Paste test text into the text area and view highlighted matches in real time
- Review the match count, each match position and the capture group list
Frequently Asked Questions
What if my regex has an error? The tool reports syntax errors (such as an unterminated group) in real time; fixing the pattern recalculates immediately.
How do I match Chinese characters? Enable the u flag and use a Unicode property escape such as `\p{Script=Han}+`, or a character range like `[\u4e00-\u9fff]+`.
Is my data uploaded to a server? No. Regex building, matching and highlighting all run locally in your browser.