Regex Tester
Quick reference
. | any character |
\d \w \s | digit / word char / whitespace |
\D \W \S | negated of the above |
[abc] [^abc] | set / negated set |
a|b | a or b |
* + ? | 0+ / 1+ / 0 or 1 |
{2} {2,5} | exactly 2 / 2 to 5 |
^ $ | start / end |
\b | word boundary |
(...) (?:...) | capture / non-capture group |
Share on Social Media:
What a regex tester is for
A regular expression (regex) is a tiny language for describing patterns in text — "an email address", "a date", "any line starting with #". Writing one correctly is fiddly, and a single wrong character can break it. A regex tester lets you build the pattern and see exactly what it matches against your own sample text, live, so you can fix it in seconds instead of guessing.
How to use it
Type your pattern in the top box and your sample text below. Matches are highlighted instantly as you type, the match count updates, and each match is listed with its position and any captured groups. Toggle the flags to change behaviour: g finds all matches, i ignores case, m makes ^ and $ match line starts/ends, s lets . match newlines, and u enables full Unicode. Everything runs in your browser using the same JavaScript engine the browser uses, so the results match real-world behaviour.
Capturing groups
Parentheses (...) create a capturing group — a sub-part of the match you can pull out separately, shown here as $1, $2 and so on. Use (?:...) when you want grouping without capturing. Groups are how you extract the year from a date, the domain from an email, or the ID from a URL.
Patterns people reach for
Email: \b[\w.%+-]+@[\w.-]+\.[A-Za-z]{2,}\b. Whole numbers: \d+. A URL: https?://\S+. Trailing whitespace: \s+$. Use the quick-reference table on the page for the building blocks, and test against messy real text — edge cases are where regexes usually fail.
Frequently asked questions
Which regex flavour is this? JavaScript (ECMAScript) regex. It is very close to PCRE/Python for everyday patterns; a few advanced features differ.
Is my text sent to a server? No — matching happens entirely in your browser.
Why does my pattern match nothing? Common causes: forgetting the g flag, unescaped special characters, or anchors that are too strict.
Relevant Tools
Link to this tool
Found this tool useful? Add it to your website or blog with one of these snippets.
Add the live, working tool to your own page:
Leave a comment