Regex Replace Tester

Preview

Result

About this tool

Test a find-and-replace before running it. Enter a pattern, flags, a replacement string (with $1 group references) and sample text; the preview highlights matches and the result box shows the output.

Questions

Why do I get no replacements with a non-global flag?
Without the g flag only the first match is replaced, exactly like String.replace in JavaScript.