Regex Tester
Test regular expressions online with live highlighting and capture groups
常用:
About this tool
A regular expression, or regex, is a powerful way to work with text: form validation, data extraction, search and replace, log analysis and more. This tool helps you write and debug patterns quickly:
- Live matching: matches are highlighted as soon as you type a pattern and input
- Flags: g for global, i for case insensitive, m for multiline and s for dotAll
- Group details: see the content and position of every capture group
- Replace test: preview the result of a substitution live
- Starter patterns: phone number, email, IP address, URL and ID number templates, ready to load
When to use it
- Write validation rules for email, phone numbers and password strength
- Extract structured data from logs or text
- Find and replace across many lines
- Learn regex syntax
All matching runs locally in the browser; nothing is uploaded.
Regex quick reference
| Token | Meaning |
|---|---|
| ^ $ | Start and end of the string |
| . | Any character except a newline |
| * + ? | Zero or more, one or more, zero or one |
| {n} {n,m} | Exactly n times, or between n and m times |
| \d \w \s | Digit, word character, whitespace |
| [abc] [^abc] | Character set, negated set |
| ( ) (?: ) | Capturing group, non-capturing group |