Get started
HomeDeveloper ToolsRegex Tester
Developer ToolsRuns in your browser · files never uploaded

Regex Tester

Test patterns live

4.8· 45 votes
A regex tester compiles a regular-expression pattern against a test string in real time and highlights every match with its captured groups. StuHub uses the JavaScript regex engine (same as browsers and Node.js), with full flag support (g, i, m, s, u, y) and a live match table.
Your file never leaves this browser. Everything runs on your device — no uploads, no server storage, no retention.How it works →
/
/
Quick samples:
Test string3 matches
Contact alice@example.com or bob.smith+work@mail.co.uk for details. Invalid: not-an-email. Another: carol_99@sub.domain.io
Matches
#1 · index 8
alice@example.com
#2 · index 29
bob.smith+work@mail.co.uk
#3 · index 100
carol_99@sub.domain.io
CHEATSHEET
Characters
.any char except newline
\ddigit 0-9
\wword [A-Za-z0-9_]
\swhitespace
\bword boundary
Quantifiers
*0 or more
+1 or more
?0 or 1
{n,m}between n and m
Anchors & Groups
^ $start / end
(abc)capture group
(?:abc)non-capture
(?<name>x)named group
[abc]character class
a|balternation

What is Regex Tester?

Test a regular expression against sample text with live match highlighting, capture-group inspection, and flag toggles (g, i, m, s, u, y). Useful for prototyping a pattern before pasting it into code, debugging a regex that isn't matching as expected, or teaching someone how a particular expression behaves.

How do I use Regex Tester?

  1. Enter your regex in the pattern field and set flags.
  2. Paste sample text into the input panel.
  3. Matches are highlighted live; expand a match to see named + indexed capture groups.

Regex Tester by the numbers

Engine
Native RegExp (V8 / SpiderMonkey)
Flags
g, i, m, s, u, y
Named groups
Supported (?<name>...)
Replace preview
Yes, with $1 / $<name> refs
Max haystack size
~1 MB comfortably

Common use cases for Regex Tester

  • Validating an email-address pattern against a fixture list.
  • Extracting every URL from a block of prose.
  • Debugging a parser for log-file timestamps.
  • Converting a Python regex to JavaScript by testing edge cases.
  • Building a redaction rule for phone numbers in user content.

Common pitfalls and how to avoid them

  • Backreferences inside lookbehind failJavaScript regex does not support them. Restructure using a lookahead or a two-pass replace.
  • Unicode characters do not matchAdd the u flag and use \p{Letter} / \p{Number} property escapes instead of ASCII-only classes.
  • Greedy pattern consumes too muchSwitch to lazy quantifiers (*? and +?) or tighten the character class inside the group.

When should I use Regex Tester?

Regex Tester is for JavaScript regex semantics (same engine your app uses). For a language-specific engine (Python, Go, PCRE), behaviours differ on edge cases — prototype here, then verify in your language.

Frequently asked
Which regex flavour does the tester use?

JavaScript regex (same engine as browsers and Node.js). Most PCRE features are supported; backreferences inside lookbehinds and recursion are not.

Which flags can I enable?

g (global), i (case-insensitive), m (multiline), s (dotall), u (unicode), y (sticky). Flags can be toggled individually without editing the pattern.

What do the coloured groups mean?

Each capturing group is highlighted in a different colour. Named groups (?<name>…) are labelled by name in the match table.

Is my file uploaded anywhere?

No. Everything runs in your browser. Your files never leave your device, and there is no server component for this tool.

Related in Developer Tools
UUID Generator
Cron Generator
Cron Parser
Timestamp Converter
Unix Time Converter
API Tester
Curl to Code
JSON to TS