Stays in your browser
Regex Tester — Test Regular Expressions Online
Free regex tester. Enter a pattern and flags to see match counts and highlighted results instantly.
Contact us at ⟦[email protected]⟧ or ⟦[email protected]⟧ today.
- #1 @14 → [email protected]
- #2 @39 → [email protected]
Testing a pattern before it ships
Most regular expression bugs are not syntax errors but over-matching. An unanchored pattern finds a substring anywhere, so a four-digit pattern happily matches the middle of a longer number, and a greedy wildcard consumes everything up to the last occurrence of the following token rather than the first.
Test against the strings that should fail. A pattern with ten passing examples and no negative cases is untested; the informative inputs are the near misses, such as an address missing its top-level domain or a date with the wrong separator, because those are the ones a lenient pattern accepts by accident.
Beware catastrophic backtracking. Nested quantifiers can take exponential time on an input that does not match, which turns a validation endpoint into a denial-of-service vector. Prefer specific character classes and anchors over nested repetition, and cap the input length when the pattern comes from outside your code.
FAQ
- Which flags are supported?
- Standard JavaScript RegExp flags such as g, i, m, s, and u.
- What if the pattern is invalid?
- You will see a syntax error without crashing the page.
- Is my text uploaded?
- No. Matching runs in your browser.
- What is the difference between greedy and lazy matching?
- A greedy quantifier takes as much as it can and gives back only what the rest of the pattern requires, while a lazy one takes as little as possible. The difference shows up in markup, where a greedy pattern spans from the first opening tag to the last closing one and a lazy one stops at the first pair.
- How do I match an email address?
- Keep the pattern loose. A strict pattern that tries to implement the full specification rejects valid addresses and is hard to maintain, while a simple pattern that checks for an at sign with text on both sides catches genuine typos. Send a confirmation message to do the real validation.
- What are lookahead and lookbehind?
- They assert that something does or does not occur next to a match without consuming it, which lets you require a digit somewhere in the string while anchoring the actual match elsewhere. Support varies by engine, so verify that your target runtime implements the flavour you rely on.