Morphy
Home / Regex Tester

Regex Tester

Try out regular expressions on the spot. As you type, you can check match highlighting, capture groups, and a replacement preview in real time. Everything happens only inside your browser and nothing is sent out.

Regular expression
/ / g
Test string
Match highlights
Replace (optional) reference with $1, $2, $<name>
Replacement result

Common patterns (cheat sheet)

PurposeRegex
Email address (simple)[\w.+-]+@[\w-]+\.[\w.-]+
Date YYYY-MM-DD(\d{4})-(\d{2})-(\d{2})
URL (http/https)https?://[^\s]+
Full-width or repeated spaces[\s ]+
Digits only\d+
Japanese (hiragana)[ぁ-ゖ]+

How to use

Enter a regular expression in the top box and the text you want to test in the box below, and matches are shown in color. Flags (such as g match all, i ignore case) are toggled with checkboxes. Using capture groups shows the breakdown of each match in the table below. Enter something like $1 in the replace box to preview the result after replacement.

Note: the regular expressions here use JavaScript (ECMAScript) syntax. Everything runs in your browser, and what you enter is never sent anywhere.

FAQ

Is what I enter sent anywhere?

No. All matching happens in your browser (on your device) and nothing is sent out.

Which language's regular expressions are these?

They're JavaScript (ECMAScript) regular expressions. Some syntax differs from Python or PCRE.

Can I use named capture groups?

Yes. Named groups like (?<year>\d{4}) also appear in the table, and you can reference them as $<year> in a replacement.

Is it free to use?

Yes — free and no sign-up required.

Related tools