Regular Expression Tester & Debugger

Test and debug regular expressions online with real-time match highlighting, capture group extraction, replace/substitution preview, and preset pattern templates conforming to the ECMAScript ECMA-262 specification.

How to use

1

Enter your regular expression pattern in the pattern input bar.

2

Toggle matching flags (g for global, i for case-insensitive, m for multiline, s for dotAll, u for Unicode, y for sticky).

3

Enter or paste your test text in the test string editor.

4

Inspect highlighted matches, full match offsets, and numbered or named capture groups in the match inspector panel.

5

Optionally enter a replacement template in Substitution mode to test regex find-and-replace transformations.

How regular expression evaluation works

A regular expression (regex) is a sequence of characters that specifies a search pattern in text. Under the ECMAScript ECMA-262 specification, JavaScript regex engines parse expressions into abstract syntax trees, compiling them into finite-state automata (either deterministic DFA or non-deterministic NFA with backtracking) to execute pattern matching against target strings.

RegExp flags and behavior

FlagNameStandard Behavior
gGlobalFinds all matches in the input string rather than stopping after the first occurrence. Updates lastIndex on the RegExp object.
iIgnore CasePerforms case-insensitive matching according to Unicode CaseFolding rules.
mMultilineTreats ^ and $ anchors as matching the beginning and end of each line (separated by \n or \r\n), rather than the beginning and end of the entire string.
sDotAllAllows the wildcard dot . character to match line break terminators (\n, \r, \u2028, \u2029).
uUnicodeEnables full UTF-16 surrogate-pair handling and allows Unicode property escapes such as \p{Letter} and \p{Script=Greek}.
yStickyMatches only from the exact index indicated by the lastIndex property in the target string.

Capture groups and replacement tokens

Parentheses (...) create numbered capture groups that extract specific sub-patterns from a matched sequence. Named capture groups (?<name>...) associate human-readable identifiers with captured content. In substitution mode, replacement strings can reference captures using standard tokens:

  • $&: Inserts the complete matched substring.
  • $1, $2, ... $n: Inserts the 1st through n-th numbered capture group.
  • $<name>: Inserts the named capture group specified by name.
  • $`: Inserts the portion of the string preceding the match.
  • $': Inserts the portion of the string following the match.
  • $$: Escapes a literal dollar sign character.

Common regex pitfalls and performance

Regular expressions using nested quantifiers with overlapping sub-patterns (such as (a+)+$) can lead to catastrophic backtracking, where an NFA engine tests an exponential number of permutations against non-matching inputs. Our evaluator executes with strict execution safeguards and timeout protections directly in your browser session to ensure stability.

Zero server transmission guarantee

Test strings frequently contain proprietary log files, internal database dumps, customer emails, or authentication credentials. All regex compilation, matching, and substitution occur strictly inside your local web browser using client-side JavaScript. No data is transmitted to external servers.

Frequently asked questions

Which regex flavor does this evaluator use?

This tool uses the native ECMAScript (JavaScript) RegExp engine conforming to the ECMA-262 specification. It supports standard JavaScript flags including g, i, m, s, u, and y.

What is the difference between non-capturing groups and capturing groups?

Standard parentheses (abc) create a capture group that stores matched text for extraction and backreferences. Non-capturing groups (?:abc) group expressions for quantifiers (e.g., (?:abc)+) without incurring memory or numbering overhead.

What are lookaround assertions?

Lookarounds are zero-width assertions: positive lookahead (?=...), negative lookahead (?!...), positive lookbehind (?<=...), and negative lookbehind (?<!...). They verify that following or preceding text satisfies a condition without consuming characters in the match.

Why is my regex not finding all matches in the text?

By default, regular expressions stop after finding the first match. To find every occurrence across the entire input string, ensure that the global (g) flag is activated.

Are my test strings or regular expressions stored on a server?

No. All regular expression compilation and matching execute 100% locally in your web browser. No inputs or text strings are sent to any remote server or third party.