Yueser

Regex tester

See matches as you type, with errors reported instantly.

/ /
About freezing

There is a 5,000-match cap that stops a match explosion from locking the page. It does not protect against catastrophic backtracking inside a single match — with something like (a+)+$ against a long, nearly-matching string, browsers have no regex timeout and the page will still hang until you close the tab. Watch out for nested quantifiers.

When to use it

  • While writing a log parser or a validation rule, you want to watch match positions and capture-group numbering as you type, to see whether bracket placement shifted a group.
  • You are debugging zero-width matches and lastIndex under the g flag (^, \b, empty matches), checking whether the same position matches repeatedly and needs manual advancing.

When not to

  • The pattern comes from an untrusted source (user-defined rules), or the subject is over 1MB: JavaScript runs it synchronously on the main thread with no timeout and no way to interrupt, so catastrophic backtracking freezes the tab.
  • You need PCRE/PCRE2 features (\A, \z, atomic groups (?>), conditionals, recursion) or the actual replace and split output: JS RegExp has different syntax and none of those, so test with the engine you will deploy on.
Limits and privacy

Matching and highlighting run locally in your browser; the text is not uploaded. Limits: JavaScript's native RegExp syntax, not PCRE; only the g, i, m and s flags; the 5000-match cap guards against result explosion but not catastrophic backtracking, and there is no timeout; keep the subject under about 1MB.

Frequently asked

Can a regex freeze the page?

Yes, and the 5000-match cap here will not stop it. The cap limits how many matches are produced, guarding against a short pattern hitting a huge document; the deadly case is a single match with catastrophic backtracking, such as (a+)+$ against a long run of a's followed by one character that cannot match, where time grows exponentially with length. Browsers have no regex timeout, so the main thread keeps computing until it finishes and closing the tab is the only escape. Avoid nested quantifiers, replace .* with a narrower character class, and cap input length first.

Which flags are supported — why no u or y?

g, i, m and s: global, ignore case, multiline, and dot-matches-newline. There are no toggles for u (Unicode code points), y (sticky), d (indices) or v (Unicode sets); you would construct the RegExp in the console instead. Note that u changes escaping and quantifier behaviour, so patterns with emoji or \p{...} may match nothing at all without it.

What does a capture group showing not matched mean?

That the group did not participate in the match, so its value is undefined rather than an empty string. It happens with optional groups (a)? and with branches that were not taken. Highlighting and replace can disagree: in replace an undefined group becomes an empty string, so test with !== undefined — a truthiness check would mistake a legitimate empty match for a missing one.