Regex Tester & Debugger
Master regular expressions with real-time testing, detailed explanations, and a comprehensive pattern library
| Pattern | Description | Example |
|---|---|---|
| . | Any character except newline | a.c matches "abc", "adc" |
| \d | Digit (0-9) | \d+ matches "123" |
| \w | Word character (a-z, A-Z, 0-9, _) | \w+ matches "hello_123" |
| \s | Whitespace (space, tab, newline) | \s+ matches spaces |
| [abc] | Character set | [abc] matches "a", "b", or "c" |
| [^abc] | Negated character set | [^abc] matches any char except a,b,c |
| Pattern | Description | Example |
|---|---|---|
| * | 0 or more (greedy) | ab*c matches "ac", "abc", "abbc" |
| + | 1 or more (greedy) | ab+c matches "abc", "abbc" |
| ? | 0 or 1 (greedy) | ab?c matches "ac", "abc" |
| {n} | Exactly n times | a{3} matches "aaa" |
| {n,m} | Between n and m times | a{2,4} matches "aa", "aaa", "aaaa" |
| *? +? ?? {n,m}? | Lazy versions | ab*?c matches "ac", "abc" (shortest match) |
| Pattern | Description | Example |
|---|---|---|
| ^ | Start of string/line | ^hello matches "hello world" |
| $ | End of string/line | world$ matches "hello world" |
| \b | Word boundary | \bword\b matches "word" as whole word |
| \B | Non-word boundary | \Bond\B matches "mond" in "mond" |
| Pattern | Description | Example |
|---|---|---|
| (abc) | Capture group | (abc)+ captures "abc" |
| (?:abc) | Non-capturing group | (?:abc)+ doesn't capture |
| (?=abc) | Positive lookahead | \w+(?=ing) matches "walk" in "walking" |
| (?!abc) | Negative lookahead | \w+(?!ing) matches "walk" in "walk" |
| (?<=abc) | Positive lookbehind | (?<=re)start matches "start" in "restart" |
| (? | Negative lookbehind | (? |
| Sequence | Description |
|---|---|
| \\ | Backslash |
| \/ | Forward slash |
| \n | Newline |
| \t | Tab |
| \r | Carriage return |
| \0 | Null character |
Click "Test" to load a pattern into the Regex Tester. Click "Copy" to copy to clipboard.
Frequently Asked Questions
Upgrade to Premium Tools
Get access to our complete suite of professional tools, templates, and resources.
How to Use the Regex Tester & Debugger
Type your regular expression pattern in the pattern field at the top. Enter your test string in the text area below. Matches are highlighted instantly as you type, with each match group shown in a different color.
Use the flag toggles (global, case-insensitive, multiline) to modify matching behavior. The match results panel shows each match with its index, captured groups, and position in the string.
The cheat sheet sidebar provides quick reference for common regex syntax — character classes, quantifiers, anchors, and lookaheads — so you do not need to leave the page to look up patterns.
Why Use This Tool
Regular expressions are powerful but notoriously difficult to write correctly. A single misplaced character can change what a pattern matches. This tester gives you instant visual feedback, making it much easier to build and debug patterns.
Instead of writing a regex, running your code, checking the output, adjusting, and repeating, you can iterate visually in seconds. This dramatically speeds up development when working with text parsing, form validation, log analysis, or data extraction.
Key Features
- Live pattern matching with color-coded highlights
- Support for global, case-insensitive, multiline, and dotAll flags
- Capture group visualization with numbered group display
- Built-in regex cheat sheet for quick syntax reference
- Match details panel showing positions and group values
- Test against multiple lines of input simultaneously
Frequently Asked Questions
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. It is used in programming and text processing to find, match, replace, or validate strings. For example, the pattern '\d{3}-\d{4}' matches phone number formats like '555-1234'.
Which regex flavor does this tool use?
This tool uses JavaScript's built-in RegExp engine, which follows the ECMAScript specification. This is the same regex engine used in web browsers, Node.js, and most JavaScript environments.
What do the regex flags mean?
The 'g' (global) flag finds all matches instead of stopping at the first one. The 'i' (case-insensitive) flag ignores letter case. The 'm' (multiline) flag makes ^ and $ match line beginnings and endings. The 's' (dotAll) flag makes the dot match newline characters.
Can I test regex for other programming languages?
JavaScript regex is similar to regex in Python, Java, and PHP for most common patterns. However, some advanced features like lookbehinds, named groups, or possessive quantifiers may differ between languages. For language-specific testing, use a dedicated tool for that language.