Test, debug, and learn regular expressions with real-time highlighting, match groups, and replace mode. 30+ patterns included.
Need to test a regex fast? This free regex tester online lets you write and debug regular expressions with instant visual feedback — no downloads, no sign-ups, and your data stays 100% private in your browser. Whether you're building form validation, parsing logs, extracting data from HTML, or learning regex for the first time, this regular expression tester gives you everything you need: real-time match highlighting, capture group inspection, flag toggles, and a full replace mode — all in one lightweight page.
Unlike other regex tools that send your data to a server, this online regex tester runs entirely client-side. Your patterns and test text never leave your device. It supports all modern JavaScript regex features — lookaheads, lookbehinds, named groups, Unicode escapes — making it suitable for Node.js, frontend validation, and server-side JavaScript workflows. Below the tool, you'll find a comprehensive regex tutorial with 30+ tested patterns covering email, URL, phone, date, HTML tags, and more — perfect for leveling up your regex skills.
Bookmark this regex tester for your daily development workflow. It's fast, free, and works offline after the initial page load — ideal for the terminal, the coffee shop, or anywhere you need to debug a pattern without an internet connection.
| # | Full Match | Groups | Index |
|---|
g (global — find all matches, not just first), i (case-insensitive), m (multiline — ^ and $ match line boundaries), or s (dotAll — . matches newlines).$1, $2 for captured groups, and see the transformed output in real time.Click any pattern row to load it into the tester above. Each pattern includes a description and real matching examples.
| Pattern | Description | Matches |
|---|---|---|
\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b | Email address | user@example.com, a.b@co.uk |
https?:\/\/[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!$&'()*+,;=]* | URL (http/https) | https://example.com/path, http://a.co |
\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b | IPv4 address | 192.168.1.1, 10.0.0.255 |
\b\d{4}-\d{2}-\d{2}\b | Date (YYYY-MM-DD) | 2026-08-03, 1999-12-31 |
\b\d{2}/\d{2}/\d{4}\b | Date (MM/DD/YYYY) | 08/03/2026, 12/25/2026 |
\b(?:\+?\d{1,3}[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}\b | Phone number (US/Intl) | 555-123-4567, (800) 555-1234, +1-800-555-1234 |
#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\b | Hex color code | #FF5733, #abc, #00FF00 |
\bpassword\b (word boundary) | Word boundary matching | password (not passwords) |
<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>(.*?)<\/\1> | HTML tags (with content) | <div>hello</div>, <span class="x">text</span> |
\/\*[\s\S]*?<\/code> | CSS/JS block comments | /* This is a comment */ |
\/\/.*$ (multiline) | Single-line comments (//) | // this is a comment |
^\s*$ (multiline) | Empty lines | Blank lines in text |
\b[A-Z]{2,}\b | Uppercase acronyms | HTML, CSS, API, JSON, SQL |
(["'])(?:(?=(\\?))\2.)*?\1 | Quoted strings | "hello world", 'it\'s ok' |
\b(\w+)\s+\1\b | Duplicate words | the the, is is, and and |
^(?!.*\b(password|secret|token)\b).*$ | Lines NOT containing sensitive words | Lines without "password", "secret", "token" |
(?<=\/\*)[\s\S]*?(?=\*\/) | Lookbehind/lookahead: content inside /**/ | Extracts just the comment text |
\b(?=\w{8,}\b)(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])\w+\b | Strong password (8+ chars, upper/lower/digit/special) | P@ssw0rd!, Str0ng#Pass |
\b(0?[1-9]|1[0-2]):([0-5][0-9])\s?(AM|PM)\b | 12-hour time | 9:30 AM, 12:45PM, 11:00 pm |
(?:[A-Z][a-z]+\.?\s)+ | Proper name (capitalized words) | John Smith, Dr. Jane Doe |
\b[1-9]\d{2}-\d{2}-\d{4}\b | US SSN format | 123-45-6789 |
\b[1-9]\d{4}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]\b | Chinese ID number (18-digit) | 110101199001011234 |
\b[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\b | UUID v4 | 550e8400-e29b-41d4-a716-446655440000 |
^(.*)$ (multiline) | Match every line | Each line as a separate match |
([\w.-]+)\.(jpg|jpeg|png|gif|svg|webp|ico)\b | Image filenames | photo.jpg, logo.svg, banner.webp |
\b([A-Za-z_][\w]*)\s*=\s*([^;\n]+) | Variable assignments | name = "Alice", count=42 |
(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?) | Strict IPv4 (0-255 each octet) | 192.168.1.1, 255.255.255.0 (not 999.999.999.999) |
^\s+|\s+$ (multiline) | Leading/trailing whitespace | Spaces and tabs at line edges |
(?<=\d)(?=(\d{3})+$) | Thousands separator position | Insert commas: 1234567 → 1,234,567 |
\b[\w.-]+@[\w.-]+\.\w+\b | Simple email (loose) | user@example.com |
A regular expression (regex) is a sequence of characters that defines a search pattern. Think of it as a supercharged Ctrl+F — instead of searching for a literal string like "hello", you can search for patterns like "any word that starts with 'h' and ends with 'o'" (\bh\w*o\b). Regex is built into every major programming language and is essential for form validation, log parsing, data extraction, and text processing.
Literal characters match themselves: abc matches the exact sequence "abc".
Metacharacters have special meaning: . ^ $ * + ? { } [ ] \ | ( ).
To match a literal metacharacter, escape it with \: \. matches a period, \\ matches a backslash.
[abc] — matches a, b, or c[a-z] — matches any lowercase letter[0-9] — matches any digit (same as \d)[^abc] — matches anything except a, b, c\d — any digit. \D — any non-digit\w — any word character (letter, digit, underscore). \W — any non-word\s — any whitespace (space, tab, newline). \S — any non-whitespace. — any character except newline (or including newline with s flag)* — zero or more (greedy). *? — zero or more (lazy)+ — one or more. +? — one or more (lazy)? — zero or one (optional){n} — exactly n times. {n,} — n or more. {n,m} — between n and mGreedy vs. Lazy: <.*> on "<div>hello</div>" matches the entire string. <.*?> matches just <div> and </div> separately.
^ — start of string (or start of line with m flag)$ — end of string (or end of line with m flag)\b — word boundary (between \w and \W)\B — not a word boundaryExample: ^Hello matches "Hello" only at the start. world$ matches "world" only at the end. \bcat\b matches "cat" but not "category" or "scatter".
(...) — capturing group. Matches and remembers the content(?:...) — non-capturing group. Matches but doesn't remember(?<name>...) — named capture group\1, \2 — backreference to captured group 1, 2Example: (\w+)\s+\1 matches a word followed by itself (useful for finding duplicate words like "the the").
(?=...) — positive lookahead: followed by ...(?!...) — negative lookahead: NOT followed by ...(?<=...) — positive lookbehind: preceded by ...(?<!...) — negative lookbehind: NOT preceded by ...Example: \d+(?=px) matches digits followed by "px" (great for extracting CSS values). (?<=\$)\d+ matches digits preceded by "$" without including the dollar sign.
a|b — matches a OR b(cat|dog) — matches "cat" or "dog" as a group(?i) — inline case-insensitive mode(?m) — inline multiline modeForm validation: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/ validates email addresses on the client side before form submission.
Log parsing: /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/ extracts ISO timestamps from server logs.
Text cleanup: /^[\s\t]+|[\s\t]+$/gm strips leading and trailing whitespace from every line — perfect for cleaning pasted data.
Data extraction: /#([0-9A-Fa-f]{6})\b/g pulls all hex color codes from a CSS file into a structured list.
g to see all matches, not just the first one..* is eating too much, use .*? instead.Yes. No sign-up, no credit card, no usage limits, no ads. It's a community tool for developers. All processing happens in your browser — there's no server to maintain, so there are no costs to pass on.
No. Everything happens locally in your browser using the JavaScript RegExp engine. Your patterns, test text, and match results never leave your device. This is especially important if you're testing against sensitive data like customer records, log files, or proprietary code.
JavaScript's native RegExp engine (ECMAScript specification). It supports all modern features: named groups, lookbehinds (ES2018+), Unicode property escapes (\p{L}), dotAll flag, and sticky flag. It is fully compatible with Node.js and all modern browsers.
Common causes: (1) You forgot the g flag and expect multiple matches. (2) You need the i flag for case-insensitive matching. (3) The . doesn't match newlines — toggle s (dotAll) if needed. (4) Your anchors (^, $) behave differently without the m flag. Enable the flags above and test again.
Yes. Once the page loads, all regex testing runs purely in your browser — no network requests. You can disconnect from the internet and continue debugging your expressions. Save the page locally or bookmark it for airport/coffee-shop coding sessions.
Match mode highlights all matches and shows capture groups. Replace mode transforms the text — enter a replacement string (like [$1] or REDACTED) and see the result instantly. Use $1, $2 to reference captured groups in your replacement.