Regex Tester Online Free
Test regular expressions with real-time match highlighting. Supports all standard JavaScript regex flags.
About this tool
How to test a regular expression
Type your pattern, paste some sample text, and matches are highlighted as you type. Adjust the pattern and watch the highlighting change. That immediate feedback is the entire point, because regular expressions are far easier to debug by observation than by reasoning.
A short refresher
The building blocks cover most everyday needs. \d matches a digit, \w a word character, \s whitespace. . matches almost anything. Quantifiers follow what they repeat: * zero or more, + one or more, ? optional, {2,4} a specific range. Square brackets define your own set, so [aeiou] matches any vowel. Anchors pin a match in place: ^ at the start, $ at the end.
The traps that catch everyone
Greediness. .* takes as much as it possibly can. Matching an HTML tag with <.*> swallows everything from the first angle bracket to the last one on the line. Add a question mark, .*?, to make it lazy and stop at the first opportunity.
Unescaped dots. A literal full stop must be written \., otherwise it matches any character at all, which is why so many naive email patterns accept nonsense.
Over-ambition. Validating email addresses properly by regex is famously close to impossible. Check for an @ with something either side, then send a confirmation message. That is what real systems do.
Frequently asked questions
Which flavour does this use?
JavaScript's, which is close to PCRE for everyday patterns but differs on lookbehind and some Unicode escapes.
What do the flags do?
g finds every match rather than stopping at the first, i ignores case, m makes the anchors work per line.
Is my text sent anywhere?
No. Everything is evaluated in your browser.
Written and maintained by Nudge Systems, Surat
Last reviewed