4 ms·
Regex's are awesome as a swiss army knife. Though in my experience, outside some edge cases where the format never changes (like matching a domain name in a UR
by zaarn 9y ago
Regex's are awesome as a swiss army knife.
Though in my experience, outside some edge cases where the format never changes (like matching a domain name in a URL) a regex is hell to maintain when you come back 3 years later.
There is also always the fun of people trying (and failing) to use regex in emails.
- ulucs 9y ago.+@.+ seems to be the only one without too many false-negatives
- zaarn 9y agoWell the best solution is to check if .+@(.+) matches and then try to lookup what the capture group returned via your DNS resolver. If it has an MX record (or CNAME to something with MX), then deliver the mail to there. If you can't resole the domain part, return an error.