Regex Library
Tested regex patterns for every language
Search
Matches names, descriptions, tags and pattern text.
ECMAScript RegExp in browsers and Node.js.
A regex checks the shape of a value, not its meaning: a matching value can still be wrong, unassigned or inactive.
Patterns
46 of 46 patterns
Details
Email address in text
Finds email-like addresses inside text such as contact lines or logs.
Intent: Finds occurrences inside longer text; it is not anchored.
Pattern
Reference pattern (JavaScript)
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}Flags: g
JavaScript code
const pattern = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
const matches = text.match(pattern) ?? [];Caveats
- Matches the common shape only; it does not prove the address exists or accepts mail.
- Quoted local parts, IP-literal domains and internationalized addresses are not matched.
- On long text without a match, backtracking engines (JavaScript, PCRE, Python, Java, .NET) can take quadratic time because each start position rescans the same characters. Limit the input length or add a timeout before running it on untrusted text.
Examples
Should match
alice@example.comMatchesReach bob.smith+test@mail.example.org todayMatches
Should not match
alice@localhostNo matchuser@exampleNo matchnot an emailNo match
Examples are checked live with the JavaScript engine in your browser.
Related Tools
What is Regex Library?
Regex Library is a curated, searchable catalog of tested regular expressions for validation, extraction, logs, networking, secret detection and text cleanup. Every pattern shows its intent, caveats, and examples that should and should not match, and opens directly in Regex Tester.
How to use
- 1.Search by name or tag, or pick a category.
- 2.Choose your regex flavor: JavaScript, PCRE, Python, Java, Go or .NET.
- 3.Select a pattern to see the variant for that flavor, its flags, caveats and examples.
- 4.Copy the pattern, copy it as code, or open it in Regex Tester to try your own text.
Flavors and intent labels
Patterns are written once in JavaScript syntax and checked in every flavor for lookaround, named groups, backreferences, Unicode property escapes and end-anchor behavior. Go (RE2) has no lookaround or backreferences, so those patterns are marked as not supported instead of being changed silently. Intent labels say what a pattern is for: practical validation, strict syntax, extraction, approximate detection or cleanup.
Privacy and limitations
The catalog runs entirely in your browser and makes no network requests. Examples are verified with the JavaScript engine; other flavors can behave differently where the flavor notes say so. A regex checks the shape of a value, not its meaning: it cannot prove that an email address exists, a card number is valid or a key is active.
