Regex Tester

Test, debug and visualize regular expressions with real-time matching

Live matching | 100% client-side
Regular Expression
/ /
Flags:
Test String
Match Results
Find & Replace
Quick Reference

Click a pattern to load it into the regex input

Regex Cheatsheet
Your Privacy

All regex testing happens entirely in your browser. No data is ever sent to any server. Your patterns and test strings stay completely private on your device.

What Are Regular Expressions?

The essential pattern-matching language used by developers worldwide

Regular expressions (regex) are sequences of characters that define search patterns. Originally developed in the 1950s by mathematician Stephen Kleene, regex has become an indispensable tool in software development. It is used for validating input (emails, phone numbers, URLs), extracting data from text, performing search-and-replace operations, and parsing log files and structured data.

Every modern programming language — JavaScript, Python, Java, PHP, Ruby, Go, C#, and more — provides built-in support for regular expressions. While the core syntax is largely shared, each language may have minor variations in supported features like lookbehinds, named groups, or Unicode properties.

Pattern Matching

Find specific text patterns in strings, from simple character sequences to complex nested structures with quantifiers, alternation, and lookaheads.

Input Validation

Validate user input like email addresses, phone numbers, URLs, credit card numbers, and custom formats with precise pattern rules.

Search & Replace

Transform text by replacing matched patterns with new strings, using capture groups to rearrange, reformat, or restructure data programmatically.

Common Regex Patterns

Ready-to-use patterns for everyday validation and extraction tasks

Pattern Description Example Match
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} Email address [email protected]
https?:\/\/[^\s/$.?#].[^\s]* URL https://example.com/path
\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4} US phone number (555) 123-4567
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b IPv4 address 192.168.1.1
\d{4}[-/]\d{2}[-/]\d{2} Date (YYYY-MM-DD) 2025-03-15
#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3}) Hex color code #ff6600
^[a-zA-Z0-9_-]{3,16}$ Username (3-16 chars) john_doe42
(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,} Strong password MyPass1word

How to Use This Regex Tester

Follow these simple steps to test and debug your regular expressions

1

Enter Pattern

Type your regular expression in the pattern input field. You can also click a quick reference pattern to get started.

2

Set Flags

Toggle the regex flags (g, i, m, s, u) to control matching behavior like case sensitivity, multiline mode, and global matching.

3

Add Test String

Paste or type the text you want to match against. Matches are highlighted instantly as you type in real time.

4

Review & Replace

See all matches with their positions and capture groups. Use the replace section to test substitution patterns with $1, $2, etc.

Frequently Asked Questions

Everything you need to know about regular expressions and this regex tester

A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. It is used in programming and text processing to match, find, and manipulate strings. Regex is supported by virtually every modern programming language, text editor, and command-line tool.
Each flag modifies how the regex engine processes the pattern: g (global) finds all matches instead of stopping at the first; i (case-insensitive) ignores case differences; m (multiline) makes ^ and $ match line beginnings and endings; s (dotAll) makes . match newline characters; and u (unicode) enables full Unicode matching and proper surrogate pair handling.
Capture groups are created by enclosing part of a pattern in parentheses (). When a match is found, each group captures the substring that matched its portion of the pattern. Groups are numbered starting at 1 and can be referenced in replacement strings using $1, $2, etc. Named groups use the syntax (?<name>...) and can be referenced with $<name>.
Yes. All regex testing, matching, and replacement happens entirely in your browser using JavaScript. No data is ever sent to any server. Your patterns and test strings stay completely private on your device. You can verify this by checking the Network tab in your browser's Developer Tools.
This tool uses the JavaScript RegExp engine. While most basic regex syntax (character classes, quantifiers, alternation, groups) is shared across languages, some advanced features may behave differently. For example, JavaScript does not support possessive quantifiers (++) or atomic groups. For JavaScript, TypeScript, and Node.js projects, this tool provides exact results.
By default, quantifiers like *, +, and ? are greedy — they match as many characters as possible. Adding a ? after them (e.g., *?, +?, ??) makes them lazy, matching as few characters as possible. For example, given the string <b>bold</b>, the pattern <.*> greedily matches the entire string, while <.*?> lazily matches only <b>.