Email with Display Name
intermediateMatches email addresses with optional display name like 'John Doe <john@example.com>'.
emailvalidationparsingdisplay-name
Pattern
/(?:([\w\s]+)\s+)?<?([\w.+-]+@[\w-]+\.[a-zA-Z]{2,})>?/gTry It
0 of 6 strings matched
Explanation
Optionally captures a display name (word characters and spaces) followed by an email address that may be enclosed in angle brackets. Group 1 captures the display name, group 2 captures the email.
Test Strings
Matching
- John Doe <john@example.com>
- jane@example.org
- Support Team <support@company.com>
Non-matching
- <>
- John Doe
- < >
Language Compatibility
| Language | Support |
|---|---|
| JS | Full support |
| PYTHON | Full support |
| JAVA | Full support |
| PHP | Full support |
| GO | Full support |
Code Snippets
const regex = /(?:([\w\s]+)\s+)?<?([\w.+-]+@[\w-]+\.[a-zA-Z]{2,})>?/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);