Text

Regex Tester

Test JavaScript regular expressions against sample text.

Runs in your browser
Common flags
Results Ready
0 matches


            

About Regex Tester

Regex Tester runs JavaScript regular expressions against sample text and highlights matches, capture groups, and flags for quick pattern iteration.

Common uses

  • Test a validation pattern before adding it to code.
  • Explore how global and case-insensitive flags change matching.
  • Check capture groups against realistic log or input samples.

Good to know

JavaScript regular expressions can behave differently from regex engines in other languages, so retest patterns in the runtime that will use them.

How to test a pattern

Use realistic examples that include both matching and non-matching text. A regex that works for one happy-path string can fail when whitespace, casing, punctuation, or line breaks change.

JavaScript regex behavior

This page uses browser JavaScript regular expressions, so flags, lookbehind support, Unicode handling, and escaping rules should be compared with the runtime where the pattern will be deployed.

Common mistakes

Overly broad patterns can match text you did not intend. Add anchors, character classes, and sample failures to make validation patterns easier to trust.

Worked example: Finding ticket identifiers in a log line

Input
Pattern: \b[A-Z]{2,5}-\d+\b   Text: Fixed API-142 and WEB-9
Expected result
Matches: API-142, WEB-9

Word boundaries prevent partial matches inside longer identifiers. Because this tool uses JavaScript regular expressions, retest the pattern if the production runtime uses another engine.

Technical reference

The behavior described on this page was reviewed against MDN: Regular expressions. External standards remain authoritative when their requirements differ from a browser implementation.

Before you rely on the output

  • Retest patterns and comparisons in the final runtime when whitespace, line endings, locale, or regex-engine differences can change the result.
  • Privacy mode: inputs are processed locally in your browser and are not intentionally sent to an application server.

Related tools

Text Diff

An unhandled error has occurred. Reload x