Test regular expressions in real time
A regex tester is an interactive tool that lets you write a regular expression pattern and instantly see which parts of your test string it matches. Instead of guessing whether your pattern works, you get real-time feedback: matches are highlighted, capture groups are extracted, and syntax errors are caught before you ship code.
Our free online regex tester is built directly into the browser — no downloads, no sign-ups, no tracking. It uses the JavaScript RegExp engine, which means the syntax matches what you'll use in JavaScript, TypeScript, Python (with minor differences), and most modern languages. Whether you're validating an email input, extracting data from a log file, or cleaning up a dataset, a regex tester is the fastest way to get your pattern right.
Unlike a static code example, a live tester lets you iterate. You'll often find that a pattern works on your first test string but fails on edge cases — a live tester surfaces those failures immediately. That's why seasoned developers keep a regex tester tab open while coding, rather than trying to "write it right" on the first try.
Using our regex tester is straightforward:
\d+, not /\d+/).g) to find all matches, "case insensitive" (i) to ignore case, "multiline" (m) to make ^ and $ match per line, and "dotall" (s) to make . match newlines.The tester updates in real time as you type — no "submit" button needed. If your pattern has a syntax error, the status box will show an error message instead of matches.
Debug patterns faster and avoid common traps:
g (global) to find all matches, i for case-insensitive, or m to make ^ and $ match per-line.(a+)+b can freeze your browser on certain inputs. If the tester hangs or the page becomes unresponsive, your regex has a backtracking problem.(...) creates a capture group. The tester shows group matches separately — invaluable when you're pulling values out of text rather than just validating format.Even experienced developers hit these regularly:
. doesn't match newlines: The dot matches any character except \n. Use [\s\S] or the s (dotAll) flag if you need to match across lines..* grabs as much as possible, often more than you want. Try .*? (lazy) when you need the smallest match — especially important in HTML parsing.., +, *, ?, [, (, {, |, ^, and $ all have special meaning. If you want the literal character, escape it with \.\d only matches 0-9: In most engines \d matches Unicode digits too (e.g. Arabic numerals). If you strictly need ASCII 0-9, use [0-9] explicitly.Step 1: Type your regular expression pattern into the input field. Do not include the leading and trailing slashes — just the pattern itself (e.g. [a-z]+).
Step 2: Set flags if needed. Use g for global (find all matches), i for case-insensitive, m for multiline mode, or s for dotAll mode (allows . to match newlines).
Step 3: Enter your test string in the large text area. As you type, matches are highlighted in real time.
Step 4: Review the match count and highlighted matches. Use the regex reference below if you're unsure about a pattern.
| Pattern | Meaning | Example Match |
|---|---|---|
[a-z]+ |
One or more lowercase letters | hello |
\d+ |
One or more digits | 123 |
\w+@\w+\.\w+ |
Simple email pattern | user@example.com |
^https?:// |
Starts with http:// or https:// | https://... |
[\w\.-]+@[\w\.-]+ |
Better email pattern | user.name@domain.co.uk |
| Character | Meaning | Example |
|---|---|---|
. |
Any character except newline | a.c matches "abc", "a c" |
\d |
Digit [0-9] | \d+ matches "123" |
\w |
Word character [a-zA-Z0-9_] | \w+ matches "hello_123" |
\s |
Whitespace (space, tab, newline) | a\sb matches "a b" |
^ |
Start of string (or line in multiline mode) | ^Hello matches "Hello world" |
$ |
End of string (or line in multiline mode) | world$ matches "Hello world" |
* |
0 or more | ab*c matches "ac", "abc", "abbc" |
+ |
1 or more | ab+c matches "abc", "abbc" |
? |
0 or 1 (or makes quantifier lazy) | colou?r matches "color", "colour" |
[abc] |
Character class (any one of a, b, or c) | [aeiou] matches any vowel |
(...) |
Capture group | (\d+) captures digits |
Use these real-world patterns as starting points:
^[\w.-]+@[\w.-]+\.[A-Za-z]{2,}$ — Basic email validation (not perfect, but catches most typos)https?://[\w.-]+(?:/[\w./?%&=-]*)? — Finds http/https URLs in text<[^>]+> — Matches opening HTML tags (use lazy .*? to avoid over-matching)\b(\w+)\s+\1\b — Finds repeated words like "the the" or "very very"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d@$!%*?&]{8,}$ — At least 8 chars, uppercase, lowercase, digitPro Tip: Test these patterns in the tool above with sample text. Modify them to fit your specific use case — regex is rarely "one size fits all".
JavaScript (ECMAScript) regex. Compatible with most modern programming languages.
g (global), i (case-insensitive), m (multiline), s (dotAll). Combine them: e.g. "gi".
Yes, but with caveats. JavaScript regex is very similar to Python, Java, C#, and PHP — most patterns work across all of them. However, some advanced features (like lookbehinds, which JS added in ES2018) may not work in older engines. If you're targeting a specific language, test in that language's regex tester too.
Common reasons: (1) You forgot to escape backslashes in strings (in Python/Java, `\d` not `\d`), (2) You're using flags inconsistently, (3) The regex engine version differs (older browsers may not support lookbehinds or named groups). Always double-check escapes when copying patterns to code.
`*` is greedy — it matches as much as possible. `.*?` is lazy (non-greedy) — it matches as little as possible. Example: on input `"bold"`, `<.*>` matches `bold` (the whole thing), while `<.*?>` matches `` (just the first tag). Use lazy quantifiers when parsing HTML/XML to avoid over-matching.
Escape them with a backslash: `\.` matches a literal dot, `\*` matches a literal asterisk. In string literals (Python, Java, etc.), you need to double-escape: `"\."` because the string parser consumes one backslash before the regex engine sees it.