ToolSink

Regex Tester

Test JavaScript regular expressions with live match highlighting, flags and capture groups.

//g
2 matches
Contact us at hello@toolsink.com or press@toolsink.com.
  • #1 [1432] “hello@toolsink.com
    groups: $1=“hello$2=“toolsink.com
  • #2 [3654] “press@toolsink.com
    groups: $1=“press$2=“toolsink.com

What is the Regex Tester?

The Regex Tester lets you write a regular expression and instantly see what it matches inside a block of text. Matches are highlighted, capture groups listed and replacement previews rendered — all in real time as you type.

Regex is powerful but notoriously fiddly. Small differences (a stray `?`, an escape you missed) can change everything. Having a live preview turns the trial-and-error cycle from painful to fun, and helps developers, data analysts and content editors build reliable patterns quickly.

The tool runs entirely inside your browser using the JavaScript regex engine, so no text or expression is uploaded to any server.

How to use the Regex Tester

  1. 1Type your regular expression into the pattern box.
  2. 2Add flags (g for global, i for case-insensitive, m for multi-line, s for dotAll).
  3. 3Paste your target text into the sample area.
  4. 4Watch matches highlight as you type — capture groups appear underneath.
  5. 5Optionally test a replacement pattern (with $1, $2 backreferences).

Key features

  • Live match highlighting
  • Capture-group inspector
  • All standard JavaScript flags (g, i, m, s, u, y)
  • Replacement preview
  • Cheat-sheet reference
  • Handles multi-line text
  • Fully offline

Examples

Extract emails

Highlights every email address inside a block of text.

Input
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}

Validate a URL

Checks whether the entire input is an http or https URL.

Input
^https?://[^\s]+$

Replace tabs with spaces

Pattern `\t` with replacement ` ` (two spaces) globally cleans tabbed text.

Why use this tool

  • Instant feedback speeds up regex learning
  • Reveals hidden matches (whitespace, invisible chars)
  • Prevents shipping broken validators to production
  • Great teaching aid for coding bootcamps
  • No data leaves your browser

Common use cases

  • Building form validation patterns
  • Extracting data from log files
  • Cleaning up CSV rows
  • Writing search-and-replace rules for editors
  • Testing routing patterns for frameworks
  • Building linter rules

Frequently asked questions

Which regex flavour does the tool use?

JavaScript’s ECMAScript regex engine, so patterns work in browsers and Node.js.

Does it support lookbehind assertions?

Yes, thanks to modern JavaScript engines.

How do I test a Python regex?

Most patterns are compatible, but Python-only features like named groups with `(?P<...>)` differ. Consider testing in Python separately.

Does the tool save my patterns?

Only in the current tab. Refresh clears state.

Can I share a regex with others?

Copy your pattern and sample text — sharable link support is on the roadmap.