Build an email extractor that does not pretend to validate the internet
Construct a bounded email extraction regex and explain its limits.
Extract likely email addresses from support notes without swallowing sentence punctuation or claiming full RFC validation. TDD: examples first, scoped regex second, limits documented third The common shortcut /\S+@\S+/ treats every non-space as part of the address, so it grabs trailing punctuation and misses the difference between extraction and validation. Write examples Pass: alex+vip@support.example.com and sam@company.co.uk. Reject or trim: alex@example.com. at sentence end. The examples define extraction behavior before pattern debate starts. Constrain the local part [A-Za-z0-9._%+-]+ This covers common work addresses without pretending to support every legal edge case. Constrain the domain [A-Za-z0-9.-]+\.[A-Za-z]{2,} A visible dot and alphabetic suffix…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in