Regex Tester
Test regular expressions with real-time highlighting, capture groups, and replace mode. Instant feedback as you type.
Test String
0 charsWhat is regex?
Regular expressions (regex) are powerful pattern-matching tools used in programming, text editors, and command-line tools. They define search patterns using special characters and quantifiers, letting you find, validate, extract, or replace text with surgical precision. Regex is supported in every major programming language.
How to use this tool
- Type your regex pattern between the
/ /delimiters. - Toggle flags (g, i, m, s, u) as needed.
- Paste or type your test string — matches highlight instantly.
- Switch to Replace mode to test substitutions.
Regex quick reference
| . | Any character (except newline) |
| \d \w \s | Digit, word char, whitespace |
| ^ $ | Start / end of string (or line with m) |
| * + ? | 0+, 1+, 0 or 1 (quantifiers) |
| {n,m} | Between n and m repetitions |
| [abc] | Character class (a, b, or c) |
| (…) | Capturing group |
| (?<name>…) | Named capturing group |
| a|b | Alternation (a or b) |
| \b | Word boundary |
Common use cases
- Validate email, phone, URL formats
- Extract data from logs and structured text
- Find and replace in code editors
- Parse and transform CSV/JSON data
- Clean and normalize user input
- Route matching in web frameworks
Frequently Asked Questions
What is a regular expression (regex)?
A regular expression is a sequence of characters that defines a search pattern. It's used in programming and text editors to match, find, and manipulate strings. Regex is supported in virtually every programming language including JavaScript, Python, Java, Go, and more.
What do the flags (g, i, m, s, u) mean?
g (global) finds all matches, not just the first. i (case-insensitive) ignores upper/lowercase differences. m (multiline) makes ^ and $ match start/end of each line. s (dotAll) makes . match newline characters too. u (unicode) enables full Unicode matching.
Does this tool upload my data anywhere?
No. All regex testing and matching happens entirely in your browser using JavaScript's built-in RegExp engine. Nothing is sent to any server — your patterns and test strings stay on your device.
Why does my regex cause the page to freeze?
Some patterns cause 'catastrophic backtracking' — exponential matching time on certain inputs. Common culprits are nested quantifiers like (a+)+ or (a|b)*c with long non-matching strings. Try simplifying your pattern or using atomic groups / possessive quantifiers if your regex engine supports them.
What are capturing groups?
Parentheses () create capturing groups that extract parts of a match. For example, (\d{4})-(\d{2})-(\d{2}) on '2024-01-15' captures '2024', '01', and '15' separately. Named groups use (?<name>...) syntax for more readable patterns.
What's the difference between .* and .*? (greedy vs lazy)?
.* is greedy — it matches as much as possible. .*? is lazy (non-greedy) — it matches as little as possible. For example, on '<b>bold</b>', <.*> matches the entire string, while <.*?> matches just '<b>' and '</b>' separately.
Can I use this to test regex for other languages?
This tool uses JavaScript's RegExp engine, which is very similar to regex in most languages. However, some features differ between engines (e.g., lookbehind support, named groups syntax). JavaScript regex is compatible with most common patterns used in Python, Java, Go, and C#.
Related tools
More free, private, browser-based utilities — no upload, no sign-up.

Davemi Tools