Web & Developer Tools

Regex Tester

Test JavaScript regular expressions, flags, matches, indices, and capture groups locally.

Regex Tester — Online Calculator

Enter a pattern to see matches.
Advertisement

The Regex Tester checks a regular expression against sample text and shows matches using the selected flags.

Use anchors, character classes, groups, quantifiers, and escaped literals deliberately. Test both matching and non-matching examples, and remember that JavaScript, PCRE, RE2, and other engines differ.

Limitations

A passing sample does not prove production safety. Review catastrophic backtracking risk, input limits, Unicode behavior, and the target engine before deployment.

Method

The tester compiles the pattern with selected flags in the browser's JavaScript regex engine, then evaluates it against sample text. Match locations and capture groups follow JavaScript semantics. Invalid syntax or flags are pattern errors, not non-matches.

Example

^\\d{4}-\\d{2}-\\d{2}$ matches 2026-09-08 because anchors require the entire string to fit the date-shaped pattern. It rejects Date: 2026-09-08 because the prefix violates the start anchor.

Interpretation

A match proves only that the sample satisfies the pattern. It does not validate calendar rules or guarantee compatibility with another language's engine. Add negative cases, boundaries, Unicode, and long inputs before deployment.

Common questions

Why does a regex differ across languages?

Dialects vary in escapes, lookbehind, named groups, Unicode behavior, and flags. Test in the same engine used by your application.

Can regex parse nested data?

Usually not reliably; use a dedicated parser for nested or context-sensitive formats.

Related Tools