What is a Regular Expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. It’s used to find, match, and extract text that follows a specific format — like phone numbers, email addresses, dates, or any pattern you can describe. Regular expressions are supported in nearly every programming language and text editor.
While powerful, regex syntax can be tricky to get right. A small mistake — a missing backslash, a misplaced quantifier — can make a pattern match nothing at all, or worse, match the wrong things. Testing patterns live as you write them makes the process much faster and less error-prone.
What Does This Tool Do?
This tool lets you write a regular expression and test it against sample text in real time. All matches are highlighted as you type, and any capture groups are shown separately. You can also test different flags like global matching, case-insensitivity, and multiline mode.
How to Use This Tool
- Enter your regular expression in the pattern field.
- Paste or type the text you want to test in the input area.
- Matches are highlighted instantly as you type.
- Captured groups are shown below the match list.
- Toggle flags (global, case-insensitive, multiline) as needed.
Common Use Cases
- Validating formats: Test a pattern for email addresses, phone numbers, postal codes, or dates.
- Extracting data: Build a regex to pull specific fields from log files or structured text.
- Find and replace: Write and test a pattern before using it in your editor or code.
- Learning regex: Experiment with patterns and immediately see what they match.
Frequently Asked Questions
What regex flavor does this tool use?
This tool uses JavaScript’s built-in regular expression engine, which follows the ECMAScript standard. It supports most common regex features including groups, lookaheads, and character classes.
Why isn't my pattern matching anything?
Common causes: forgetting the global (g) flag for multiple matches, incorrect escaping of special characters, or using a feature not supported by the JavaScript engine (like lookbehinds on older browsers).
Is my data private?
Yes. All pattern matching runs locally in your browser — no text is sent to any server.