/    Sign up×
Community /Pin to ProfileBookmark

Need some help on a email validation function

Hi all,

I googled and found the following javascript which provides a simple email validation but I find it very difficult to understand that line. Is .test a javascript built-in function?Could somebody please explain this line for me? Thank you very much!

[CODE]
function checkEmail(email_address) {
if (/^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3})+$/.test(email_address)){ // I don’t quite understand why there are so many symbols
return (true)
}
else{
alert(“Invalid E-mail Address! Please re-enter.”)
return (false)
}
}

[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@CharlesNov 30.2005 — Google for JavaScript regular expressions. And see http://www.webdeveloper.com/forum/showthread.php?t=84592 for a more robust version of that.
×

Success!

Help @iamsuperman spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...