ow
ow copied to clipboard
Check if string is email address
What is the recommended way to check if a string is an email address?
We intentionally left this out: https://github.com/sindresorhus/ow/pull/15#discussion_r147329494
It's very hard to do this correctly. The email grammar is extremely complex and ambiguous. Your best bet is to just do string.includes('@')
and then validate that the email actually exists: https://www.google.com/search?q=validate+email&oq=validate+email&aqs=chrome..69i57j0l4j69i65.1686j0j1&sourceid=chrome&ie=UTF-8