Pattern + flags (g i m s u y) → new RegExp, match list, capture groups, and a replace preview with $1 / $&.
This is JavaScript, not PCRE or Kotlin. Nested quantifiers can still hang the tab; we cap iterations.
String.prototype.replace — supports $&, $1…$9, $`, $', $$.(Enter a replacement string to preview substitution.)
Use it to tune a JavaScript RegExp against sample text: flags g i m s u y, match table, captures, replace preview ($1, $&).
Do not assume the same pattern is valid in PCRE, Python re, or Kotlin. Lookbehind needs a modern JS engine.
Nested quantifiers can still freeze the tab; we cap iterations, we do not make the pattern safe.
new RegExp(pattern, flags), then exec in a loop when g is on (otherwise once). Highlights merged ranges in the subject.
Replace uses JS String.prototype.replace rules. Strings stay in the tab.
Pattern \b\w+@\w+\.\w+\b, flag g, subject with two addresses → two rows in the match table. Without g you only get the first.
Contact: alice@example.com or bob@test.org
That pattern is a demo, not an RFC 5322 email validator. Do not ship it as one.
g and thinking there is only one match./pattern/gi including slashes — this field is the source only.$1 in a sed script that wants \1.HTTP request builder · APK string extractor
No. ECMAScript RegExp only.
No. Keep secrets out of the subject anyway.
Catastrophic backtracking. Simplify the pattern. We cap loops; we cannot cap all engine work.
Older browsers. Drop the assertion or test in a current Chromium.