Test and debug regular expressions instantly with Regex Tester. Real-time match highlighting, flag controls, and a capture groups table. No uploads, no storage, no tracking — your data stays in your browser.
| # | Full Match | Groups | Index |
|---|---|---|---|
| No matches yet. | |||
Table of Contents
What Is a Regular Expression?
A regular expression — typically abbreviated to regex or regexp — is a short pattern of characters used to search for a pattern. A regex is not just a single match, it’s a family of matches: any email address, any date in a particular format, any line that begins with a capital letter and ends with a period. Almost every modern programming language features support for regular expressions, and they are used in commonly used applications such as form validation, find and replace in code editor, logging analysis, data scraping, etc.
Literal characters (which match themselves) and metacharacters, which describe repetition, position and character classes, are used to make up a pattern. Capture groups, parentheses: Groups in results table above are sub-matches that can be extracted, you will use parentheses to build them.
When Do You Need a Regex Tester?
When a pattern doesn’t work as expected, you take out the regex match checker. Perhaps your email validation regexp is tolerant of common misspellings, your phone number pattern doesn’t include extensions, or your log-parser regexp mistakenly matches too many groups. The best way to gain confidence in a pattern is to test it against real sample data including edge cases you would expect it to fail. A regular expression validator also comes in handy when you receive a code snippet with an obscure regular expression in some legacy code and you want to know what it does before you change it.
Why Use Our Regex Tester?
It is easy to write a regular expression. And it is here that the majority of developers lose time in writing one that really does what you want — and nothing more! Our free online regex tester fills this void by letting you know what your pattern matches as you type. Any character you edit in the expression automatically updates the highlighted text in your test string, eliminating guess work, compilation and jumping back and forth between your code editor and a terminal.
This regular expression tester is unlike other heavier regex tester & debuggers, which are used to repeat the same task dozens of times every day: paste a pattern, paste a sample string, check the matches. The capture groups table has the numbered groups with exact index positions of a match, so it’s easy to test the extraction logic before deployment to production. Also, since the tool operates completely in your browser and uses the built-in JavaScript regular expression engine, the test data stays safe on your machine — which is a requirement if you are testing real user data, log files or confidential data.
How to Use the Regex Tester
- Enter your pattern in the Regular Expression field. You’re not required to include the surrounding slashes — they’re included to make it easier for you to read.
- Use flags (e.g. g, i, m) to alter the behavior of the regex engine.
- Paste your test string into the Test String area. Matches appear highlighted as you are typing them.
- Review the results table on the right. The full match, capture groups, and starting character position of the match per row.
- If your pattern is syntactically incorrect, you will see a red alert explaining what is wrong with your pattern, so that you can correct it quickly.
Common Regex Patterns & Examples
These battle-tested patterns cover the most frequent validation and extraction tasks. Copy any of them into the tester above to see how they behave against your own data.
| Use Case | Pattern | Matches |
|---|---|---|
| Email address | \b[\w.%+-]+@[\w.-]+\.[A-Za-z]{2,}\b | user@example.com |
| URL | https?:\/\/[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]* | https://example.com/page |
| US phone number | \(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4} | (555) 123-4567 |
| IPv4 address | \b(?:\d{1,3}\.){3}\d{1,3}\b | 192.168.1.1 |
| Date (YYYY-MM-DD) | \d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]) | 2026-08-21 |
| Hex color | #(?:[0-9a-fA-F]{3}){1,2}\b | #1a2b3c |
Understanding Regex Flags
The flags are placed before the pattern and affect its interpretation. This tool helps you with the six built-in flags of JavaScript:
- g (global) — do not end search after the first match.
- i (ignore case) — match letters case insensitively.
- m (multiline) — cause ^ and $ to refer to the beginning and end of each line, rather than the beginning and end of the string.
- s (dotAll) — make the dot . match newline characters.
- u (unicode) — Match full Unicode characters and surrogate pairs as well as Unicode property escapes.
- y (sticky) — only match at the same point as the previous match, for lexers and parsers.
See the MDN Web Docs regular expressions guide for the definitive reference on JavaScript regular expression syntax, flags and engine behavior. It is a listing of all the tokens supported by the engine which this tool operates on.
FAQs
Is this free regular expression tester?
Yes. There are no hidden paywalls, and no sign-up, usage limits or fees for this tool. It’s in your browser, so there’s no server cost to recoup.
What regular expression flavor does this tool employ?
It is based on your browser’s built-in JavaScript (ECMAScript) regex engine. Syntax which is different from PCRE, Python or .Named groups (old browsers) or lookbehind support (NET) could be different in those browsers.
Is my test data sent anywhere?
No, all matches are local in browser and done with javascript. There is no upload, log or storage of anything you type into the pattern field or test string.
Why my pattern works in here and not in my code?
Most often it is the result of a difference in flavor: for instance, a construct written in Python that a PCRE would recognize but a JavaScript that would not; or a failure to account for the special meaning of backslashes in string literals in JavaScript (such as “\d+” vs. “\\d+”). Look at the flags also: without a m or g flag, results are drastically different.
What are capture groups?
The portion of a pattern enclosed by parentheses will be returned as capture groups. Each group stores the text that it matched as a separate value, from left to right. The results table above shows all groups for all matches for easy verification of extraction logic.
Related tools
Calculators | Converters | Games | Generators | Random | Web Tools | Developer Tools