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?
Who is Participating?
Michel PlungjanConnect With a Mentor IT ExpertCommented:
var reg = /@hotmail|@gmail|@live\.|@googlemail/
var email = 'asdsa@gmail.com'
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.
Michel PlungjanIT ExpertCommented:
Perhaps not with the / /

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


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.
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

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
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.