Regex Tester

Test regular expressions against your text

Matches highlighted
2 matches

Why test regex in the browser?

Regex engines vary subtly between languages: PCRE (PHP), POSIX (grep), Perl, Python's `re`, and JavaScript's regex have different feature sets. Testing in the browser uses the JavaScript engine — exactly what runs in your client-side code, in Node.js, or in Inertia validation rules.

The tester highlights matches as you type, lists capture groups per match, and shows the regex flags currently in effect. Bad patterns show a clear syntax error rather than failing silently.

Examples

Extracting emails with capture groups
Input
Pattern: \b([\w.]+)@([\w.]+)\.([a-z]{2,})\b
Flags: gi
Text: Contact [email protected] or [email protected]
Output
Match 1: [email protected]
  Group 1: alice
  Group 2: example
  Group 3: com

Match 2: [email protected]
  Group 1: bob
  Group 2: test
  Group 3: org

Frequently asked questions

Which regex flavour is supported?

JavaScript / ECMAScript regex. Supports lookbehind in modern browsers, named groups (`(?<name>...)`), Unicode mode (`u` flag), and sticky matching (`y` flag).

Why doesn't my PCRE pattern work?

PCRE has features JavaScript regex doesn't: recursive patterns, possessive quantifiers, conditional patterns. JavaScript covers most everyday needs but not those advanced cases.

How do capture groups work?

Parentheses around a part of the pattern create a numbered capture group. Inside the match, group 1 is the first `(...)`, group 2 the second, etc. Use `(?:...)` for a non-capturing group.

Will an infinite-loop regex hang the browser?

Catastrophic backtracking can freeze the tab briefly. The tester runs in your tab so a bad pattern affects only this tool — close and reopen if needed.

Is my pattern or test text uploaded?

No — both stay in your browser.