4 ms·
After extensive research, I have finally come up with a way to improve upon 99.99%. I have come up with a regex which will work for 100% of email addresses, and
by falcolas 12y ago
After extensive research, I have finally come up with a way to improve upon 99.99%. I have come up with a regex which will work for 100% of email addresses, and a significant number of regex engines, as an added bonus! Behold:
.*@.*
/s
- fphilipe 12y ago.+@.+ Should do the trick
- falcolas 12y agoI considered that one, but I'm sure there's some system out there which doesn't require an account name ahead of the "@" symbol. We're shooting for 100% accuracy, after all. ;)
- sirn 12y agoIn that case, let me improve it further :-) /@./ Though I'm not really sure there could be an email without username part.
- deleted 12y ago[deleted]
- madaxe_again 12y agoYour verbosity is outlandish. .* will match all email addresses, and as an additional feature, all other strings too! As we all know, more functionality with less code is better, therefore, this is clearly superior to all other regexes.
- moe 12y ago$ nc localhost 25 220 uhura.z ESMTP MAIL FROM:me 250 2.1.0 Ok RCPT TO:root 250 2.1.5 Ok DATA 354 End data with <CR><LF>.<CR><LF> Look ma, no @! . 250 2.0.0 Ok: queued as 8DB653E0065 quit 221 2.0.0 Bye
- falcolas 12y ago/bow .* it is!
- arthurfm 12y agoWhat regex would you suggest to match all e-mail addresses contained within an arbitrary body of text (as opposed to a single text field where you don't have worry about other text strings)?
- falcolas 12y agoThe same one. If it has an '@' symbol embedded in it, it might be an email address. The only way to know for certain is to query the server its attached to. Of course, if you're really trying to scrape email addresses reliably, looking for the '@' won't work reliably, since people are used to obfuscating their email with [at] or (at) to protect against spam (well, more spam). You will probably need to dive into AI theory to more reliably get email addresses.