KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm making a really simple email validation script that basically just checks the following that the email isn't blank the the email contains an @ symbol with at least 1 character before it that there is a domain ie @ with at least 2 letters after it that it ends with a fullstop with at least 2 letters after it I know there are many more checks, but I look at these regex rules and my mind stops working. I figure if I started with something small like this I might be able to wrap my brain around more complex rules. Currently using some jQuery I do the following: var booking_email = $('input[name=booking_email]').val(); if(booking_email == '' || booking_email.indexOf('@') == -1 || booking_email.indexOf('.') == -1) { // perform my alert } This is enough to stop 90% of bogus emails so far... I would just like to make it a bit more effective because currently my rule will allow emails like '@example.com' or ' user@domain .' because it only checks that there is a fullstop and an @ symbol.
Tags (comma-separated)
Save Edits
Cancel