Interactive Regex Tester
Write, test, and debug regular expressions with live highlights and full matching details. 100% offline.
Common Patterns
Email Address
[a-zA-Z0-9._%+-]+...
Phone Number (US/Dashed)
\d{3}-\d{3}-\d{4}
URL Website
https?:\/\/(?:www...
Date (YYYY-MM-DD)
\d{4}-\d{2}-\d{2}
IPv4 Address
^(?:[0-9]{1,3}\.){3}...
Numeric Values Only
^\d+$
Regex Configuration
/
/
Matches Highlight Overlay
No active matches found.
Understanding Regular Expressions (Regex)
A regular expression, commonly referred to as **regex** or **regexp**, is a sequence of characters that forms a search pattern. This pattern can be used for text matching, string validation, searching, replacing, and string parsing operations.
Regex is fully supported in almost all programming languages, databases, text editors, and terminals. While syntax can differ slightly depending on the engine (PCRE, JavaScript, Python, etc.), the core concepts remain universal. Using standard JS RegExp parsing, this tool processes patterns client-side.
Frequently Asked Questions (FAQ)
What do the different RegExp flags do?
- **g (Global)**: Find all matches rather than stopping after the first match.
- **i (Ignore Case)**: Match characters regardless of uppercase or lowercase distinctions.
- **m (Multiline)**: Treat beginning `^` and ending `$` anchor tokens as matching individual lines.
- **s (dotAll)**: Allows the wild character dot `.` to match newline characters (`\n`).
- **u (Unicode)**: Handles surrogate UTF-16 character codes properly.
Why is my expression causing an infinite loop or freezing?
This is caused by **Catastrophic Backtracking**. If a regex pattern contains nested quantifiers (like `(a+)+`) and the engine attempts to match against a long string of failing inputs, the number of permutations evaluated scales exponentially, freezing the JS compiler thread. Keep quantifiers simple and avoid duplicate overlaps.
What is a capture group and how do I extract them?
Putting part of a regex pattern in parentheses `( )` creates a **capturing group**. This groups characters to apply quantifiers, and remembers the matched substring, allowing you to reference it in search-and-replace queries or programmatic match arrays. Check the details listing panel to view individual group extraction arrays.