GreyScript AI

Regex Tester

Type a pattern and test text to see every match highlighted live, with capture groups listed per match and a replace preview, using JavaScript's own regex engine.

Pattern
/ /
Test string
Matches
Match details
Replace
Testing runs entirely in your browser using JavaScript's own regular expression engine (matches what Node.js and browser JavaScript accept; other languages such as Python or PCRE have small syntax differences). Nothing you enter is sent anywhere or saved.

Questions and answers

Which regex flavor does this use?

JavaScript's own RegExp engine, the same one used by Node.js and every browser. Syntax is close to PCRE (used by PHP and many other tools) but not identical; Python's re module also differs in a few details, such as named group syntax in older versions.

What do the flags mean?

g (global) finds every match instead of stopping at the first. i (ignore case) makes matching case-insensitive. m (multiline) makes ^ and $ match the start and end of each line. s (dot matches newline) lets . match line breaks too. u (unicode) enables full Unicode matching, needed for some emoji and non-Latin scripts.

Why does unchecking the g flag change the replace result?

It matches JavaScript's own behavior: String.replace only replaces the first match unless the pattern has the g flag, in which case it replaces every match. The match highlighting above always shows every match regardless of this flag, since finding all matches needs g internally.

How do I reference a capture group in the replacement?

Use $1, $2 and so on for numbered groups, or $<name> for a named group like (?<name>...). $& inserts the whole match.

Is my text or pattern uploaded anywhere?

No. Matching and replacing run entirely in your browser using JavaScript's built-in regex engine. Nothing is sent to a server or saved.