Developer utility

Regex Tester

Test JavaScript regular expressions with live matches, capture groups, named groups, flags, highlighted text, and replacement output directly in your browser.

Pattern

Build a regular expression

/ /

Compiled expression -

Waiting for input.

Matches0
Groups0
Flags-
Runtime0 ms

Match list

Matches and positions

#MatchIndexLengthGroups

Capture groups

Numbered and named groups

MatchGroupValue

Preview

Highlighted test text

Replace

Test replacement output

Examples

Common regex tests

Regex quick reference

TokenMeaningExample
.Any character except newline unless dotAll is enabled.a.c
\dDigit character.\d{4}
\wWord character: letters, digits, underscore.\w+
+One or more of the previous token.\w+
*Zero or more of the previous token..*
?Optional token or lazy quantifier marker.https?
()Capture group.(\d{4})-(\d{2})
(?<name>...)Named capture group.(?<year>\d{4})
^ / $Start and end anchors.^Title
\bWord boundary.\bcat\b

Notes for JavaScript regular expressions

  • The tester uses the browser JavaScript RegExp engine, so syntax follows JavaScript support in the current browser.
  • The global flag is useful for finding every match; the tester adds it internally for scanning when needed.
  • Use named groups such as (?<year>\d{4}) when replacement output needs readable placeholders.
  • Very broad patterns such as .* can match empty text. The tester guards zero-length matches to keep the page responsive.

Regex tester FAQ

Is this a JavaScript regex tester?

Yes. It uses the native JavaScript RegExp implementation in your browser.

Can I use replacement variables?

Yes. JavaScript replacement syntax such as $1, $2, and $<name> works in the replacement field.

Why do some PCRE patterns fail?

JavaScript regex does not support every PCRE feature. Browser support also depends on the user's current JavaScript engine.