regex for email validation
email, regex
Solution
Instead of . try matching every character except \s (whitespace):
/[^\s]*@[a-z0-9.-]*/i
Problem
I have written the regex below for a really simple email validation. I plan to send a confirmation link. ``` /.*@[a-z0-9.-]*/i ``` I would, however, like to enhance it from the current state because a string like this does not yield the desired result: test ,my.name+test@gmail-something.co.uk, test The "test ," portion is undesirably included in the match. I experimented with word boundaries unsuccessfully. - How should I modify? - Even though I've kept this simple, are there any valid email formats it would exclude? THANKS!