Extract Emails
Extracts all email addresses from a given input string.
extractEmails
The extractEmails function scans an input string and extracts all email addresses found within it using a regular expression.
Function Signature
function extractEmails(str: string): string[]Parameters
str(string): The input string to parse.
Return Value
string[]: An array of email address strings found in the input. If none are found, returns an empty array.
Example Usage
playground.ts
Notes
- Domain names are not validated for authenticity; the function only checks that the formatting matches a generic email pattern.
Last updated: Sun, Jun 14, 2026 07:06:16AM (UTC)
