TOOLS_INDEX

Regex Tester

Test JavaScript regular expressions with live highlighting, capture groups, flags, and replacement previews.

g

Regular expression flags
FLAGS

Hover or focus a flag to see how it changes matching.

0 LINES / 0 CHARS
MATCH_PREVIEW READY

MATCH_DETAILS

#INDEXMATCHCAPTURE_GROUPS
No matches yet.
REPLACEMENT_PREVIEW
VALIDATION
READY
MATCHES
0
EXECUTION_TIME
0.00 MS
FLAGS
g
REGEX TESTING / JAVASCRIPT

Test a regular expression before it reaches production

A regular expression can appear correct while matching too much, missing Unicode input, or slowing down on unexpected text. Enter the pattern without surrounding slashes, select the same flags your JavaScript code uses, and test it against representative input. Matches are highlighted without changing the source text, while the table reports the exact index, complete match, numbered captures, and named capture groups.

The replacement preview uses JavaScript replacement syntax. Use $& for the complete match, $1 for the first capture, and $<name> for a named group. The global flag controls whether one match or every match is replaced.

All matching happens in this browser tab. Test strings and patterns are not uploaded. Avoid catastrophic backtracking patterns and always place limits around untrusted input in production systems.

JavaScript regular expression flags

Flags change how the JavaScript engine reads the complete expression, which means the same pattern can produce a different number of matches, treat line boundaries differently, or interpret characters with another set of rules when only one letter is added.

g Global
Find every match instead of stopping after the first one. Replacement also continues through the complete string.
i Ignore case
Match uppercase and lowercase letters without writing both forms into the pattern.
m Multiline
Let the anchors ^ and $ match individual line boundaries inside a longer string.
s Dot all
Allow . to include line breaks, which is useful when a match may span several lines.
u Unicode
Enable Unicode-aware parsing and property escapes such as \p{Letter}.
y Sticky
Match only at the current lastIndex, which is useful when building tokenizers that consume input in order.
COPIED
PRACTICAL NOTES

Working with Regex Tester

Regex Tester is built to compile JavaScript regular expressions and inspect their matches. It stays focused.

This is especially useful for debugging validation, extraction, search, and replacement logic. Nothing about the narrow interface removes the need for judgment, but it does make the small operation easier to repeat and explain during a review.

Start with a pattern, selected flags, and representative test text. The page returns highlighted matches with indexes, captures, named groups, and replacement output, and you can inspect that result before it becomes part of another file, request, document, or application setting.

A pattern that works on a sample can still miss Unicode cases or backtrack badly on hostile input, so test boundaries and unusually long strings. Keep a reversible copy until the final result has been accepted by its destination.

A reliable workflow is to use representative input rather than a perfect demonstration sample, review the output beside the original, and repeat the operation with empty values, unusual characters, larger content, and one intentionally broken case, because a tool is most useful when it helps reveal assumptions before those assumptions reach production.