Re: RegularExpression for filtering unwanted e-mail address

Tech-Archive recommends: Fix windows errors by optimizing your registry



Raghav,

Thanks for your reply, but I'm looking for an expression that fails if a certain domain name is matched. If I use your approach I'll have to add almost every domainname on the net just to block hotmail.com, yahoo.com and gmail.com.


raghav schreef:
Hiii

<asp:RegularExpressionValidator
id="xyz" runat="server"
ErrorMessage="Message."

ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.doc|.rtf|.txt)$"


ControlToValidate="Message"></asp:RegularExpressionValidator>


Try with this, See u want to block yahoo, gmail etc etc. In the other
way round, specify only those domains u need, for eg: abc.com.It will
automatically block other domains not specified.
In the sample above replace .doc, .rtf,.txt with domains u need.

U can also give alert by using javascript.

Best Wishes
Raghav Mahajan







Sjaakie wrote:
Not sure if I this belongs in this group or a Regex-group, but since it
involves a WebControl I'll give it a try here.

I want to block hotmail, yahoo and gmail addresses when typed into a
TextBox control. Figured this could be done using a
RegularExpressionValidator control, but I can't compose a valid
expression to achieve this. Maybe you can help me out?

I used the standard e-mail validation expression, and tried to alter it
to filter Hotmail addresses. The expression below is incorrect...

\w+(-+.]\w+)*@(\w+!hotmail)([-/]\w+)*\.\w+(-.]\w+)*

TIA

.



Relevant Pages