Regex Tester

Test JavaScript regular expressions against sample text — see every match with its position, toggle flags, and get clear errors for invalid patterns.

Flags
—

How it works

A regular expression is a compact pattern language for describing text: \w+ matches a run of word characters, \d matches a digit, . matches (almost) any character, and parentheses capture parts of the match for later use. Flags change how the pattern behaves — g finds every match instead of stopping at the first, i ignores letter case, and m makes ^ and $ anchor to line boundaries rather than the whole string. Each match below is listed with its index, the character position where it starts, which is handy when slicing strings in code. If the pattern has a syntax error, the JavaScript engine's own message is shown so you can fix it. The test string is capped at 20,000 characters and matches at 500 to keep pathological patterns from freezing your tab.