Regex Tester

Test JavaScript regular expressions with flags, live match results, capture groups, and replace preview.

Pattern & Test Text

0 characters

Replace Preview

Optional
Replacement preview will appear here...

Highlighted Matches

0 matches
Match highlights will appear here...

Match Details

Capture groups included
Status
No regex tested yet.
`matchAll()` is useful for collecting all matches and capture groups, but it requires a regex with the global `g` flag when used directly with a `RegExp` object [web:569][web:581].

How it works

JavaScript uses the `RegExp` object for pattern matching, and tools like this typically build a regex from a user pattern plus selected flags such as `g`, `i`, `m`, `s`, and `u` [web:568][web:573]. To inspect every match and its captured groups, `String.prototype.matchAll()` is especially convenient, but it requires a global regex when passed a `RegExp` instance [web:581][web:569].

  • g finds all matches, not just the first one [web:571][web:575].
  • i makes matching case-insensitive [web:573].
  • m makes `^` and `$` work per line in multiline text [web:575][web:579].
  • s makes `.` match newline characters too [web:573][web:576].
  • u improves Unicode handling in JavaScript regex parsing and matching [web:576].