Skip to content

STEMSTUDIO

Try out a regular expression

Text · runs on this device

Try out a regular expression

Type a pattern and some text — matches light up as you type, with the replaced result alongside.

  • Free, no account
  • Nothing is sent

Help

Write the body only — no surrounding slashes. $1, $2 … refer to capture groups, $& to the whole match and $<name> to a named group. Write $$ for a literal $.

Processing, communication and stored data

Enter a pattern and flags (g / i / m / s / u) and the matches are highlighted in your text. Capture groups are listed by number and name, the replacement is previewed live, and an invalid pattern shows the engine’s error instead of breaking the page.

Questions

Which flavour of regex is this?

The JavaScript engine built into your browser. The basics carry over to Python, PHP and Ruby, but the details — lookbehind support, flag names, whether \A and \z exist — do not. Check the target language before moving a pattern across — the treatment of newlines, the syntax for named groups and what counts as a digit are the usual differences.

Should I include the slashes?

No. Write only the body; /abc/g would be read as a pattern that searches for literal slashes. Flags are the checkboxes under the field. When lifting a pattern out of an editor or a config file, strip the surrounding slashes and the trailing flag letters before pasting.

Nothing matches — where do I start?

Check the i flag (case) and the m flag (what ^ and $ mean), then whether symbols are escaped: . and ( mean something else unescaped. Shortening the pattern until it starts matching is the reliable way to find the piece that is wrong: start with the first few characters, confirm they match, then add one condition at a time.

Why does it stop after so many matches?

The list is capped at 500. A pattern that matches single characters produces enormous numbers of them, and putting all of those rows on the page makes it unusable. When the cap is reached the page says so. The replacement preview is unaffected and applies throughout. The table lists the first 50, while the highlighting covers every match up to the cap.

Is my text uploaded?

No. Matching and replacing happen entirely in the page, so log extracts and message bodies that you would not paste into a hosted regex site are fine here. The pattern is not sent anywhere either, which matters when it encodes the shape of an internal identifier.

Ratings from users

Ratings appear once there are 10.

Report a problem or suggest something

The tool name, this page’s path and your browser type are sent with it. Files are never sent. For a reply, use the email on the Contact page.