4 ms·
It's my observation that a lot of problems people have with regex is that they haven't learned tips like "Is regex the right way to do this?", "Can I simplify t
by proactivesvcs 10y ago
It's my observation that a lot of problems people have with regex is that they haven't learned tips like "Is regex the right way to do this?", "Can I simplify this regex because I trust the input?" and "What do I really need the regex to do?".
To validate a user-supplied email address, you arguably just need something along the lines of ^.@.\..$ to help avoid whitespace and forgetting the @ sign. In a lot of cases, if the email address is wrong, all that happens is either a) user login fails or b) user registration fails. Hence there's no need for unreadably-complex regex to validate.