Skip to main content
SuperTextTools

Regex Tester

Test JavaScript regular expressions with live highlighting, capture groups, replacement preview, and a built-in cheatsheet.

Instant 100% Private Free Forever
Regex RegExp Pattern Developer Match

The / characters are visual only — type the raw pattern (e.g. foo/bar, not escaped slashes).

Advanced
Test string 0 chars · 0 lines
Results

Type a regex pattern above to see matches

Regex Cheatsheet

Character classes

Any char except newline
Digit
Non-digit
Word character
Whitespace
Any of a, b, c
Not a, b, or c
Lowercase letters

Anchors

Start (line with m)
End (line with m)
Word boundary
Non-word boundary

Quantifiers

0 or more
1 or more
0 or 1
Exactly 3
Lazy *

Groups

Capture group
Non-capturing
Named group
OR

Common patterns

Try an example

How to use the Regex Tester

Four steps to debug patterns in your browser.

  1. 1

    Enter your pattern

    Type the raw pattern between the decorative slashes. Toggle flags (g, i, m, s, u, y) on the right.

  2. 2

    Paste a test string

    Add sample text in the left panel. Matches highlight live as you type.

  3. 3

    Inspect results

    See match count, positions, numbered groups, and named groups in the results panel.

  4. 4

    Try replacement (optional)

    Enable Find & Replace, enter $1-style replacement, preview result or diff, then copy.

What is a regex tester?

A regular expression (regex) is a compact language for describing text patterns — emails, dates, URLs, log formats, or validation rules in forms. Regex is powerful but cryptic; a single misplaced quantifier can match everything or nothing. A regex tester lets you edit a pattern and see matches highlighted instantly, which is essential before shipping code or cleaning data.

SuperTextTools runs JavaScript's native RegExp engine in your browser. Results match what you get in Node.js and modern browsers — including named capture groups, lookbehind, lookahead, and Unicode property escapes when the u flag is on.

What this tool does

  • Live match highlighting with an overlay synchronized to your test string
  • Flag toggles: global, case-insensitive, multiline, dotall, unicode, sticky
  • Per-match cards with positions, numbered groups, and named groups
  • Optional find-and-replace preview with result and diff views
  • Clickable cheatsheet patterns inserted into the editor

Common use cases

  • Form validation — email, phone, postal codes
  • Extracting fields from logs, JSON strings, or scraped HTML
  • Search-and-replace in editors and IDEs
  • URL routing rules in web frameworks
  • Linters, static analysis, and code mods
  • Data cleaning and one-off ETL in spreadsheets exported to text

Tips for writing good regex

  • Start broad, then narrow with tests on edge cases (empty input, unicode, very long lines)
  • Use non-capturing (?:...) when you do not need the captured value
  • Anchor with ^ and $ when matching whole strings
  • Prefer lazy quantifiers (*?) when matching delimited segments
  • Watch for catastrophic backtracking on nested quantifiers — refine patterns that stall on long inputs

Performance and safety

Match iteration stops after 100,000 results to prevent freezes. Test strings with HTML or script tags are escaped in the highlight layer so nothing executes. Large inputs use debounced updates (100ms) to keep typing responsive.

Frequently asked questions

Why are my matches not showing without the "g" flag?
Without the global (g) flag, JavaScript only returns the first match. Enable g to iterate all matches in the test string. We show a hint when more matches likely exist.
What's the difference between greedy and lazy quantifiers?
Greedy (default): * takes as much as possible. Lazy (add ?): *? takes as little as possible. On <a><b>, <.+> matches the whole string; <.+?> matches each tag separately.
Does this support lookbehind and lookahead?
Yes — modern JavaScript supports (?<=foo) lookbehind and (?=bar) lookahead. Results match Node.js and current browsers.
Can I save my regex patterns?
Bookmark this page or share the URL. Pattern persistence in the URL hash may be added later; for now, use examples and the cheatsheet to reload common patterns quickly.
What's "catastrophic backtracking"?
Nested quantifiers like (a+)+ can make the engine try exponentially many paths on certain inputs. We cap at 100,000 matches and show execution time on large inputs to reduce freezes.
Can I use this for Python or PCRE regex?
This tool uses JavaScript's RegExp engine. Most patterns transfer, but flavors differ. For Python-specific syntax, use a flavor-specific tester; for JS/Node/browser code, this is the right baseline.