InTab

Regex Tester

Test regular expressions with live highlighting, groups and replace.

Text & Dev: Everyday text and pattern helpers. It runs in your browser, so nothing you enter is uploaded.

What it does

The Regex Tester runs a regular expression against your text as you type. Matches are highlighted, each match is listed with its capture groups (including named groups), and a replace box shows the result of a search-and-replace. It uses JavaScript's regular expression engine.

How to use it

  1. Type the pattern without slashes.
  2. Tick the flags you need: g global, i ignore case, m multiline, s dotAll, u unicode, y sticky.
  3. Paste the Test string, or open a file.
  4. Check the highlighted matches and the groups.
  5. Type a replacement under Replace with, using $1 or lt;name> for groups.

Example

Pattern:

(?<user>[\w.]+)@(?<domain>[\w.-]+)

Text: Contact ada@example.com or linus@kernel.org

Match user domain
ada@example.com ada example.com
linus@kernel.org linus kernel.org

Replacing with lt;user> at lt;domain> gives Contact ada at example.com or linus at kernel.org.

Good to know

  • JavaScript regex supports lookbehind, named groups and Unicode property escapes such as \p{L}, but not possessive quantifiers or recursion. Patterns from PCRE (PHP), Python or .NET usually work with small changes.
  • Without the g flag only the first match is found.
  • m makes ^ and $ match at every line; s lets . match newlines.

FAQ

Why is my pattern so slow? Nested quantifiers such as (a+)+ can take exponential time on some inputs. Make the pattern more specific.

How do I match a literal dot or bracket? Escape it with a backslash: \., \( or \[.

Guides

More Text & Dev tools

  • Markdown Preview: Write Markdown with a live, GitHub-style preview. Copy or download the HTML.
  • Cron Explainer: Translate cron expressions into plain English and see the next run times.
  • Text Tools: Count characters/words/lines, sort, dedupe, trim and reverse lines.