Regex Tester

Text

Test JavaScript regular expressions with flags like g, i, m, s and u plus capture groups for building, debugging and validating match patterns.

//
3 matches
Common:
Test text
Highlighted
Contact alice@example.com or bob@test.org for details, or admin@site.io
Matches
#0alice@example.com@ 8–25
$1alice
$2example.com
#1bob@test.org@ 29–41
$1bob
$2test.org
#2admin@site.io@ 58–71
$1admin
$2site.io

About Regex Tester

A regular expression (regex) is a language for matching string patterns, supported by virtually every programming language. This tool uses the browser's native RegExp engine to provide live pattern matching with real-time syntax highlighting of matches in the input text. It supports all standard regex flags (g, i, m, s, u, y), named and numbered capture groups, lookahead/lookbehind assertions, and alternation. The match results panel displays each match with its capture groups, group names, and positional indices, making it invaluable for debugging complex patterns before you deploy them in code. Tip: Bookmark this tool for quick access whenever you need text processing. All processing happens locally in your browser — no data upload, so feel free to paste private content.

How to Use

  1. Open the Regex Tester tool
  2. Enter your regular expression in the pattern field
  3. Enter test text in the test text area
  4. View highlighted matches and the match list
  5. Use Replace mode for text substitution

Use Cases

  • Form validation — Debug email, phone, URL, and password-strength validation patterns.
  • Log extraction — Pull timestamps, error codes, IP addresses, and other fields out of large log files.
  • Batch replacement — Iterate on a regex here, then apply it via your editor's find-and-replace across the codebase.
  • Web scraping cleanup — Extract structured data — prices, titles, ratings — from scraped HTML.
  • Learning regex syntax — Tweak a pattern and see live highlights — much faster than reading docs.
  • Search and replace preview — Test regex substitution patterns with capture group references ($1, $2) before running them across your codebase.
  • Data validation pipelines — Build and debug multi-step validation patterns for CSV rows, log entries, or user-submitted form data.

FAQ

Which regex flavor does this tool use?

JavaScript / ECMAScript flavor (a subset of PCRE). Notable gaps: no \g back-references, no atomic groups (?>), no balancing groups. Python's re module is mostly compatible.

Why doesn't my regex match?

Most common reasons: (1) missing g flag matches only the first hit; (2) unescaped special chars . * ? +; (3) using ^/$ on multiline text without the m flag.

Can regex have performance issues?

Yes. Nested quantifiers like (a+)+ on a non-matching input can trigger catastrophic backtracking and freeze a page. This tool uses the native engine, which times out and aborts.

How do I test grep or sed regex?

They use BRE/ERE flavors that escape some metacharacters differently (e.g. \(\) for groups). This tool is not fully compatible — for complex shell regex, test directly in the terminal.

How do I remember common patterns?

See our Regex Cheatsheet tool, which collects ready-made patterns for email, URL, IP, credit-card, and more.

Any browser compatibility requirements?

This tool works in all modern browsers (Chrome, Firefox, Edge, Safari). No plugins or extensions required.

Can I use it offline?

After initial load, most features work offline. The core logic runs entirely in your browser with no network dependency.

Advertisement

Comments

No comments yet. Be the first!

Comments are stored locally in your browser. Configure Giscus for cloud-based comments.