How to use Regex Tester — Test Regular Expressions Online Free
- 1Type your regular expression and pick the flags you need.
- 2Paste the text to test against — matches are highlighted as you type.
- 3Check the match list for capture groups, or use the replace field to preview a substitution.
About Regex Tester
A regex is faster to write than to read, which is why a tester earns its place. Paste the text you actually have, build the pattern a piece at a time, and the highlighting tells you immediately whether you matched what you meant to — or whether a greedy quantifier quietly swallowed half the line. Every match is listed with its start and end offset, so when a pattern matches the right characters in the wrong place, you can see it rather than guess.
Capture groups are where most of the real work happens, and they get their own column. Numbered groups appear as $1, $2 and so on; named groups appear as $<name>, which is what makes a pattern self-documenting six months later. The Replace tab then runs the same pattern through String.replace so you can see the output before you commit to it — the date example turns 2024-03-09 into 09/03/2024 with $<day>/$<month>/$<year>, and swapping two fields around becomes a one-line change instead of a loop. A group that matched nothing is labelled differently from one that matched an empty string, because in a replacement those two behave the same way but in your code they do not.
Two honest limitations are worth stating. First, this is JavaScript regex: the browser compiles your pattern, so anything ECMAScript lacks — atomic groups, possessive quantifiers, recursion — will not work here and, more usefully, anything that works here will work in your JavaScript. Second, the ready-made patterns are pragmatic, not authoritative. The email pattern catches ordinary addresses including multi-label domains like example.co.in, but no regex validates an address to the letter of RFC 5322, and the only real proof an address works is a delivered message. The phone pattern matches a run of digits and separators, which is the right trade-off for finding numbers in text but will also match things that are not phone numbers. Use them as a starting point you edit, which is exactly what the one-click buttons are for.