Regex Tester

Test and debug regular expressions with real-time matching

Visual highlighting, capture groups, and pattern reference

//g
0 characters
0 matches
Matched text will appear here...

Quick Reference - Common Patterns

Regex Syntax Reference

Character Classes

.Any character (except newline)
\\dDigit (0-9)
\\DNon-digit
\\wWord character (a-z, A-Z, 0-9, _)
\\WNon-word character
\\sWhitespace
\\SNon-whitespace
[abc]Any character in set
[^abc]Any character not in set

Quantifiers

*Zero or more
+One or more
?Zero or one
{n}Exactly n times
{n,}At least n times
{n,m}Between n and m times

Anchors & Groups

^Start of string
$End of string
\\bWord boundary
\\BNon-word boundary
(...)Capturing group
(?...)Named group
(?:...)Non-capturing group

What is a Regular Expression?

A regular expression (regex) is a sequence of characters that defines a search pattern. It's a powerful tool used in programming for pattern matching, validation, text extraction, and search-and-replace operations. Regex patterns can match simple strings like email addresses or complex structures like URLs, phone numbers, and custom data formats.

How to Use the Regex Tester

1

Enter your regex pattern

Type your regular expression pattern in the pattern field. The pattern is tested in real-time as you type, showing matches instantly.

2

Select regex flags

Choose the appropriate flags for your pattern: 'g' for global matching, 'i' for case-insensitive, 'm' for multiline, and 's' for dotall mode.

3

Add test string

Enter the text you want to test against your pattern. Matches will be highlighted in yellow as you type.

4

Analyze results

View match details including the full match, capture groups, and their positions. Use the quick reference for common pattern examples.

Why Use Our Regex Tester?

Real-time feedback

See matches instantly as you type. No need to click buttons or refresh - the tester updates continuously for rapid iteration.

Detailed match info

View comprehensive match details including capture groups, indices, and the number of matches found.

Pattern reference

Quick access to common regex patterns for emails, URLs, phone numbers, and more. Copy and adapt patterns for your needs.

Error detection

Invalid patterns are immediately flagged with clear error messages, helping you debug syntax issues quickly.

Complete privacy

All regex testing runs locally in your browser. Your patterns and test strings never leave your device.

Frequently Asked Questions

Regex flags modify the behavior of pattern matching. 'g' (global) finds all matches instead of stopping at the first. 'i' (case-insensitive) makes the pattern match regardless of letter case. 'm' (multiline) treats ^ and $ as line boundaries. 's' (dotall) allows the dot (.) to match newline characters.
Capture groups are created by wrapping part of your pattern in parentheses (). They allow you to extract specific portions of matches. Groups are numbered left-to-right, starting at 1. For example, in /(\d{3})-(\d{4})/, group 1 captures the first three digits and group 2 captures the last four.
Common issues include: forgetting to escape special characters (use \ before . * + ? [ ] ( ) { } | ^ $), incorrect anchors (^ matches start, $ matches end), or not using the right flags. Use this tester to see exactly where matches occur and debug your patterns step by step.
No, all regex testing happens entirely in your browser using JavaScript's native RegExp engine. Your patterns and test strings never leave your device, ensuring complete privacy and security for sensitive data.