Skip to main content

Regex Tester

Test regular expressions with live match highlighting and replacement. Everything runs in your browser, so your input isn’t uploaded.

Loading tool…

How to use the Regex Tester

  1. Enter a pattern and choose flags such as g (all matches) or i (ignore case).
  2. Type or paste the text to search, or select Load sample.
  3. Read the highlighted matches and groups. Optionally enter a replacement to preview the result.

Example

The pattern finds an address and captures the part before and after the @ sign. With the g flag, every match is listed with its position and groups.

Pattern and text
Pattern: (\w+)@(\w+)\.com
Text: mail ada@site.com or bob@corp.com
Matches
Match 1 at 5: ada@site.com (groups: ada, site)
Match 2 at 21: bob@corp.com (groups: bob, corp)

About this tool

A regular expression is a compact pattern for finding text. Type a pattern and some test text, and every match is highlighted immediately, with its position and capture groups listed below. You can also preview a replacement.

Good to know

  • This uses JavaScript’s regular expression engine. Other languages can behave differently.
  • Some patterns can be extremely slow on certain text and may freeze this tab for a while. Test text is limited to 200,000 characters and matches to 1,000.
  • In a replacement, $1 is the first group, $& is the whole match, and $$ is a literal dollar sign.

Related tools

  • Markdown Editor – Write Markdown and see a safe live preview.
  • Case Converter – Convert text to upper, lower, title, sentence, camel, snake, kebab and more.
  • Word & Character Counter – Count words, characters, sentences, lines and paragraphs as you type.
  • Text Diff Checker – Compare two texts, in a single list or side by side, with changes highlighted.

Browse all tools