/    Sign up×
Community /Pin to ProfileBookmark

emal verification

Hi –

Does anyone know how to change this javascript code so it will allow emails with the extension .ca ?

Right it allows emails with .com and several others. But not .ca

All those characters in the syntax make no sense to me. Also, if you know of a better email checking script that is free, let me know. Thank you!

Jeff

[CODE]
if (/^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3})+$/.test(newsletterForm.email.value))
{
return true;
}
else
{
alert(“You must enter a valid email address!”);
return false;
}

[/CODE]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@CharlesSep 23.2006 — <script type="text/javascript">

String.prototype.isEmailAddress = function () {return /^[^x00-x20()<>@,;:\".[]x7f-xff]+(?:.[^x00-x20()<>@,;:\".[]x7f-xff]+)*@[^x00-x20()<>@,;:\".[]x7f-xff]+(?:.[^x00-x20()<>@,;:\".[]x7f-xff]+)+$/.test(this)}

</script>

<input type="text" onchange="if (!this.value.isEmailAddress()) {alert ('That would not appear to be a valid email address.'); this.value=''; this.focus()}" >
Copy linkTweet thisAlerts:
@KorSep 23.2006 — The code is ok, I don't see how it can not allow [B].ca [/B]... It works for me

<i>
</i>alert(/^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3})+$/.test('[email protected]'))


The code is Regular Expression test. It is something like: If the string has allowed characters (letters,digits, underscores,hyphens and dots - bot no neighbouring dots) followed by a single @ character, followed by allowed characters and the numbers of allowed characters after the last dot must be 2 or 3.

It works, what is the problem?
Copy linkTweet thisAlerts:
@haefauthorSep 23.2006 — You're right. My apologies. It does accept the ca extention. Something else must be going on.

I'll dig into the errors further.

Thanks for the quick response. Great forum.

Jeff
×

Success!

Help @haef 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 4.29,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...