Write regular expressions and see matches highlighted in real time. View capture groups, test replacements, and reference common patterns — all in your browser.

/ /
Replace
Test String
Match Highlighting
Empty
Matches:0
Groups:0
Time:
Matches
Matches will appear here...
Replace Result

Common Regex Patterns

Email AddressMatches common email formats
URLMatches HTTP/HTTPS URLs
IPv4 AddressMatches dotted-decimal IP addresses
Hex ColorMatches #RGB and #RRGGBB
Date (YYYY-MM-DD)Matches ISO date format
TimeMatches 12h and 24h time formats
Phone (US)Matches common US phone formats
HTML Opening TagMatches HTML opening tags
UUIDMatches standard UUID format
Number / PriceMatches integers and decimals

How to Use This Tool

Step 1
Write your regex
Type a pattern between the slashes. The tool validates syntax in real time and shows errors immediately.
Step 2
Set flags
Toggle g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode) to control matching behavior.
Step 3
Test against text
Paste text in the test area. Matches highlight instantly with alternating colors. The match list shows positions and capture groups.
Step 4
Try replacements
Enable Replace mode to enter a replacement string. Use $1, $2 for capture groups. The preview updates live.

Frequently Asked Questions

What is a regular expression?
A regular expression (regex or regexp) is a sequence of characters defining a search pattern. Developed from formal language theory in the 1950s and implemented in computing tools since the 1960s, regex is now supported in virtually every programming language. It's used for text search and matching, input validation (emails, phone numbers), data extraction (log parsing, scraping), and find-and-replace operations. The syntax may look cryptic at first, but it's an incredibly powerful tool once learned.
What do the regex flags mean?
The g (global) flag finds all matches in the string rather than stopping at the first. The i flag makes matching case-insensitive so /hello/i matches "Hello", "HELLO", and "hello". The m (multiline) flag makes ^ and $ match at the start and end of each line, not just the whole string. The s (dotAll) flag makes . match newline characters (it normally doesn't). The u (unicode) flag enables full Unicode support, making . correctly match emoji and other multi-byte characters.
Why is my regex matching too much (greedy vs lazy)?
By default, quantifiers *, +, and {n,m} are greedy — they match as much text as possible. For example, <.*> applied to <a>text</a> matches the entire string from the first < to the last >. Add ? after any quantifier to make it lazy (non-greedy): <.*?> matches just <a> and </a> separately. Lazy quantifiers match the minimum possible text.
What are capture groups?
Parentheses () in a regex create capture groups that extract portions of the matched text. For example, (\d{4})-(\d{2})-(\d{2}) matching "2025-01-15" captures "2025" as group 1, "01" as group 2, and "15" as group 3. In replacements, you can reference groups with $1, $2, etc. Use (?:...) for non-capturing groups when you need grouping for alternation or quantifiers but don't need to extract the match.
Is my data sent to a server?
No. All regex compilation, matching, and replacement happens entirely in your browser using JavaScript's built-in RegExp engine. Your patterns and test text never leave your device.