Regex Tester

Regex Tester

Test JavaScript regular expressions instantly with browser-side execution, optional flags, match listings, and captured group inspection. Perfect for debugging patterns, validating search rules, and teaching regex behavior safely.

regex
tester
pattern
Share this tool:
Quick Presets
Examples for common regex testing workflows
Regex Pattern & Sample Text
Paste a pattern, optional flags, and sample text to test the regex locally in your browser.
Characters: 0
Lines: 0
Bytes: 0

Supported JavaScript flags like g, i, m, s, u, and y.

Characters: 0
Lines: 0
Bytes: 0
How it works: This tester compiles your JavaScript regex locally, applies the selected match scope, and lists each match with index positions and captured groups. Nothing is sent to a server.

Complete Guide: Regex Tester

Everything you need to know about using this tool effectively

What is Regex Tester?

The Regex Tester lets you write a regular expression and test it against sample text in real time. It highlights all matches in the input text, shows match details including capture groups, and lets you toggle flags (g, i, m, s) to change matching behavior. The tool helps you debug regex patterns by showing exactly what matches and what does not. All processing happens in the browser.

This tool constructs a JavaScript RegExp from your pattern and flags, runs it against the test string using matchAll, and displays every match with its index, full match text, and captured groups. Invalid regex patterns trigger a descriptive error message.

Key Features
Real-time regex matching with highlight
Shows match count and positions
Displays capture groups per match
Toggle flags: global, case-insensitive, multiline, dotAll
Error messages for invalid patterns
Copy matches to clipboard
Quick preset patterns
Runs in the browser with no uploads
Common Use Cases
When and why you might need this tool

Debugging a regex pattern

Write a regex and test it against sample strings to verify it matches the intended text.

Extracting capture groups

Test a regex with parentheses to see what each group captures for use in code.

Learning regular expressions

Experiment with regex syntax and see immediate feedback on what matches.

Validating input patterns

Test a regex for validating emails, phone numbers, or URLs against real examples.

How to Use This Tool
Step-by-step guide to get the best results
1

Enter your regex

Type the pattern in the regex input field (without delimiters).

2

Enter test text

Paste the text you want to match against.

3

Set flags

Toggle global (g), case-insensitive (i), multiline (m), or dotAll (s) flags.

4

Review matches

See highlighted matches, match count, and capture groups.

Pro Tips
1

Use the global flag (g) to find all matches, not just the first one.

2

Capture groups are numbered from left to right starting at 1.

3

Test with edge cases like empty strings and special characters.

4

The preset patterns provide starting points for common use cases.

Frequently Asked Questions
How do I enter a regex pattern?

Type the pattern without delimiters. For example, enter \d+ to match digits, not /\d+/. The flags are toggled separately.

What do the flags mean?

g (global) finds all matches. i (case-insensitive) ignores case. m (multiline) makes ^ and $ match line boundaries. s (dotAll) makes . match newlines.

What are capture groups?

Capture groups are parts of the pattern wrapped in parentheses. Each group captures the matched text so you can extract specific portions.

Is my input sent to a server?

No. All regex execution happens in your browser using JavaScript. Nothing is transmitted.

What if my regex is invalid?

The tool shows a descriptive error message from the JavaScript regex engine explaining what is wrong with the pattern.