Related Developer Tools
Explore more free developer tools to speed up debugging, testing, and development.
Test, debug, and visualize regular expressions in real time — with live match highlighting, flag controls, named capture groups, and 20+ ready-to-use presets.
Build, test & debug regular expressions in real-time
.Any character\dDigit (0–9)\wWord char\sWhitespace\bWord boundary*0 or more+1 or more?0 or 1{n}Exactly n{n,m}Between n–m^Start of string$End of string(?=...)Lookahead(?!...)Neg. lookahead(?<=...)Lookbehind()Capture group(?:)Non-capture(?<name>)Named group|Alternation[abc]Character classFrom email validation to log parsing to JWT extraction — regex is one of the most powerful tools in a developer's toolkit. This guide covers everything you need to write, test, and debug patterns confidently.
See every match highlighted in real time as you type your pattern — no run button needed.
Patterns and test strings stay in your browser. No server processing, no data collection.
Instantly load common patterns for emails, URLs, phones, dates, IPs, logs, and more.
Inspect named group values from (?<name>...) patterns directly in the results panel.
Select a pattern below, copy it, and paste into the Pattern field above to test it live.
/gi flags[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}Contact us at support@example.com or sales@company.org for more info.
💡 Matches standard email addresses. The gi flags make it global and case-insensitive.
A regular expression (regex) is a pattern-matching language built into virtually every programming environment. It describes a set of strings using a compact syntax — letting you search, extract, validate, or replace text with a single expression instead of writing dozens of conditional checks.
Regex powers input validation in forms, log analysis in DevOps, code search in IDEs, URL routing in web frameworks, and data extraction in ETL pipelines. Mastering regex makes you significantly faster at everyday engineering tasks.
The regex engine reads your pattern and attempts to match it against the test string character by character. It uses backtracking — trying different paths through the pattern when a branch fails — to find all possible matches.
Understanding backtracking helps you avoid catastrophic backtracking — a performance trap where nested quantifiers on overlapping patterns cause exponential matching time. This tool uses JavaScript's native RegExp engine, which is optimized for most real-world patterns.
Flags modify how the engine applies your pattern. You can combine multiple flags together.
| Flag | Name | Effect | Example Use Case |
|---|---|---|---|
| g | Global | Finds all matches instead of stopping at the first | Extract all emails from a document |
| i | Case-insensitive | Matches regardless of letter case | Validate usernames case-insensitively |
| m | Multiline | ^ and $ match start/end of each line, not the whole string | Parse log files line by line |
| s | DotAll | The dot . matches newline characters too | Match multi-line HTML blocks |
| u | Unicode | Enables full Unicode matching and escape sequences | Match emoji, CJK, or non-Latin text |
| d | Indices | Adds start/end index of each match group (ES2022+) | Precise cursor positioning in editors |
.Any char except newline\dDigit [0-9]\DNon-digit\wWord char [a-zA-Z0-9_]\WNon-word char\sWhitespace\SNon-whitespace[abc]Any of a, b, c[^abc]Not a, b, or c[a-z]Range a to z*0 or more (greedy)*?0 or more (lazy)+1 or more (greedy)?0 or 1 (greedy){n}Exactly n times{n,}n or more{n,m}Between n and m^Start of string/line$End of string/line\bWord boundary\BNon-word boundary(?=...)Positive lookahead(?!...)Negative lookahead(?<=...)Positive lookbehind(?<!...)Negative lookbehind(abc)Capture group(?:abc)Non-capturing group(?<name>abc)Named capture group(?|abc|def)Branch reset\1Backreference to group 1\k<name>Named backreference\Escape next character|Alternation (OR)(Open group[Open char class{Open quantifier\nNewline\tTab\rCarriage return^\s+|\s+$Trim whitespace\s+ Multiple spaces\d{4}-\d{2}-\d{2}ISO date\b\w+\bWhole words(?i)wordCase-insensitive word^.{8,}$Min 8 charsNamed groups make your regex results readable. Instead of match[1], you access values by name with match.groups.name.
const pattern = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/g;
const text = "Events: 2024-01-15, 2023-12-31";
for (const match of text.matchAll(pattern)) {
const { year, month, day } = match.groups;
console.log(`Year: ${year}, Month: ${month}, Day: ${day}`);
}
// Year: 2024, Month: 01, Day: 15
// Year: 2023, Month: 12, Day: 31💡 Paste (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) into the pattern field above and test it with "Events: 2024-01-15, 2023-12-31" to see group inspection live.
Everything you need to write, test, and debug regex patterns in one free, browser-based workspace.
Matches are highlighted the instant you type — no need to click run or submit. Flags update results immediately too.
Load from 20+ vetted patterns for emails, URLs, IP addresses, dates, phone numbers, hex colors, and more.
Named capture groups from (?<name>...) patterns are displayed by name in the results panel for easy inspection.
Invalid regex patterns trigger an instant, clear error message so you can identify and fix syntax issues immediately.
Toggle g, i, m, s, u, and d flags independently from the UI — results update live with each flag change.
Export your pattern in /pattern/flags format with one click — ready to paste into any JavaScript, TypeScript, or JSON file.
Common questions about regular expressions, flags, groups, and best practices.
Explore more free developer tools to speed up debugging, testing, and development.