textbox validation exclude gmail and hotmail emails

I have been looking for a regular expression for an asp.net textbox ('tbEmail') so that NO Hotmail or GMail addresses are allowed but have been unsuccessful. Please could an expert point me to something that will get the job done or supply some code to do the above?
clearchannelAsked:
Who is Participating?
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
<script>
var reg = /@hotmail|@gmail|@live\.|@googlemail/
var email = 'asdsa@gmail.com'
alert(reg.test(email.toLowerCase()))
</script>
0
 
clearchannelAuthor Commented:
Ok, does the syntax "/@hotmail|@gmail|@live\.|@googlemail/" work in an asp.net validation control?
 
I should have made the question clearer I want to check for valid email address but exclude gmale, hotmail etc.
 
0
 
Michel PlungjanIT ExpertCommented:
Perhaps not with the / /

Remember to ask if it does NOT match then it is ok

http://msdn.microsoft.com/en-us/library/ms998267.aspx



0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
clearchannelAuthor Commented:
Maybe someone with .net skills can answer for me as I do tno think your regexp will will in .net validation control.
 
0
 
clearchannelAuthor Commented:
Here is the vb.net code:
If (System.Text.RegularExpressions.Regex.IsMatch(sEmail, "@hotmail|@gmail|@live|@googlemail")) Then
                errorMessage.Text = "The following emails are not valid; Hotmail, GMail, Googlemail and MSN Live"
End If

Open in new window

0
 
Michel PlungjanIT ExpertCommented:
you may want to add a dot to the @live

since it is only @live.com or @live.co.xx which is a new hotmail address
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.