Skip to content
Dev Utilities

Regex Tester

Regex tester online: test regular expressions against sample text with live match highlighting, capture groups and flags, using JavaScript regex.

  • #regex tester online
  • #regular expression tester
  • #javascript regex
  • #regex
  • #regular expression
  • #pattern
  • #match
  • #test
100% client-side

Runs in your browser. Your data never leaves this device.

The Workbench
Regex Tester — workspaceLive
//
Network requests0
Bytes uploaded0
Trackers fired0
The Guide

About Regex Tester

/01 What a regex tester does for you

A regular expression is a pattern for matching text, and it is one of those skills everyone half-knows. The syntax is compact, powerful, and easy to get subtly wrong, which is why testing a pattern against real text before trusting it is not optional.

This regex tester does exactly that. Write your pattern in one field, paste your sample text in another, and every match is highlighted live as you type. Below the text, each match is listed with the capture groups it produced, so you can see not just what matched but which pieces of it landed in which group. Change one character in the pattern and the whole result updates instantly.

That immediate feedback is the difference between understanding a pattern and guessing at it. You can try a change, see the effect, and try again in seconds, which is how regex actually gets learned rather than merely tolerated.

And because the pattern runs against your text entirely in your browser, you can safely paste real log lines, production data, or anything else you would not hand to an unknown website.

/02 The flags, and what each one changes

Flags modify how the pattern behaves, and they are toggleable here with a click so you can see exactly what each one does. Global makes the search continue past the first match and find them all. Without it, you get one match and stop, which surprises anyone who expected everything.

Case-insensitive does what it says, and it is worth toggling on a moment before deciding a pattern does not work, since half of the cases where a pattern matches nothing are a case mismatch. Multiline changes what the anchors mean: normally caret and dollar match only at the very start and end of the whole string, but with multiline they match at every line break too, which is what you want when processing text line by line.

Dotall lets the dot match newlines, which it otherwise refuses to do. If your pattern was meant to span lines and only matched the first one, this is the flag that fixes it. Toggle each flag and watch the highlight change: it teaches what a paragraph of documentation cannot.

/03 Groups: the numbers that move

Capture groups are the brackets in your pattern, and they are how you pull pieces out of a match. The groups panel here shows every group for every match, so you can see your pattern working at the level of detail that matters.

The thing to know about groups is that they are numbered by the order of their opening brackets, left to right, across the whole pattern. Which means adding a group in the middle silently renumbers every group after it. If your code references group 3, and you add a bracket before it, group 3 is now something else, and nothing warns you. This is one of the classic silent bugs of regex work, and seeing the groups laid out per match makes it visible instead of invisible.

Named groups fix the problem: a group written with a name keeps its identity no matter what you add around it. Non-capturing groups let you group for logic, like applying a quantifier to a sequence, without consuming a number. Both are worth reaching for whenever a pattern grows past a couple of brackets.

/04 When a pattern matches nothing

The most common regex failure is the quiet one: the pattern runs, matches nothing, and the code proceeds as if the text was absent. The usual cause is an unescaped special character. Dot, plus, question mark, brackets, braces, and pipes all have meaning in a pattern, and to match one literally you need a backslash in front of it.

The second most common is a flag issue: the match needed the global flag, or the case-insensitive one, or the pattern anchored at line starts when the string was one long line. The third is an anchor mismatch: the pattern expects the text to start with something, and the text has a space or a prefix before it.

This tester makes all three diagnoses fast. No highlight means no match, so the feedback is instant. Remove the anchors and see the match appear: it was an anchor problem. Toggle the flags: it was a flag problem. Add the backslash: the dot is a literal dot again. Working with a live highlight turns debugging a pattern from a guessing game into a search you can see.

/05 Regex flavours: JavaScript, Python, Java and PCRE

This regex tester online runs your pattern with the JavaScript engine built into your browser, the same one used by Node.js and by any validation or search code running on a web page. What matches here is exactly what matches in JavaScript.

Most everyday syntax is shared across languages: character classes, quantifiers, anchors, groups, alternation and lookahead behave the same in JavaScript, Python, Java, C# and PCRE. The differences show up at the edges. Python writes named groups as (?P<name>...), while JavaScript and .NET use (?<name>...). Possessive quantifiers and atomic groups exist in Java and PCRE but not in JavaScript. Inline flags such as (?i) at the start of a pattern work in Python and PCRE but not in older JavaScript. Test with the engine your code will actually run, or check the documentation for anything beyond the common core.

FAQ

Questions about Regex Tester.

How do I test a regex pattern online?
Type the pattern in one field and paste your sample text in another. Matches are highlighted live as you type, and each match is listed with its capture groups so you can see exactly what matched and where.
What do the g, i, m, and s flags do?
Global finds every match instead of stopping at the first. Case-insensitive ignores letter case. Multiline makes the start and end anchors match at every line break. Dotall lets the dot match newlines. Toggle each one and watch the highlight change.
Why does my pattern match nothing?
Most often an unescaped special character, since dots, plus signs, and brackets need a backslash to match literally. After that, check whether the pattern needed the global or case-insensitive flag, or whether the anchors expect the text to start exactly where it does not.
What are capture groups in regex?
The bracketed parts of your pattern, which capture the text they matched so you can use it later. They are numbered by opening-bracket order, so adding a group in the middle renumbers everything after it — named groups avoid that problem.
Which regex flavour does this tester use?
JavaScript's, since it runs in your browser. Most syntax is shared across languages, but lookbehind support, named groups, and Unicode escapes vary — check your target language if the pattern is destined elsewhere.
Is my test text sent anywhere?
No. The pattern runs against your text entirely in your browser, so you can safely test against real log lines and production data that you would never paste into an unknown service.
Can I test Python regex here?
For most patterns, yes, because the common syntax is identical. Watch for Python-specific features such as (?P<name>...) named groups or inline flags; rewrite named groups as (?<name>...) to test them in JavaScript.
What is the difference between this and regex101?
regex101 lets you switch between several engines and explains patterns token by token. This tester focuses on fast, private JavaScript testing with live highlighting, and your test text never leaves the browser.
How do I match an email address with regex?
A practical pattern is ^[^\s@]+@[^\s@]+\.[^\s@]+$, which requires text, an @, a domain and a dot. A fully standards-compliant email regex is extremely long, so real validation should also send a confirmation email.
Related