473,776 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RegularExpressi on for filtering unwanted e-mail address

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
RegularExpressi onValidator 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+!hotm ail)([-/]\w+)*\.\w+(-.]\w+)*

TIA
Sep 12 '06 #1
6 2290
Hiii

<asp:RegularExp ressionValidato r
id="xyz" runat="server"
ErrorMessage="M essage."

ValidationExpre ssion="^(([a-zA-Z]:)|(\\{2}\w+)\$ ?)(\\(\w[\w].*))(.doc|.rtf| .txt)$"
ControlToValida te="Message"></asp:RegularExpr essionValidator >
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
RegularExpressi onValidator 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+!hotm ail)([-/]\w+)*\.\w+(-.]\w+)*

TIA
Sep 12 '06 #2
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:RegularExp ressionValidato r
id="xyz" runat="server"
ErrorMessage="M essage."

ValidationExpre ssion="^(([a-zA-Z]:)|(\\{2}\w+)\$ ?)(\\(\w[\w].*))(.doc|.rtf| .txt)$"
ControlToValida te="Message"></asp:RegularExpr essionValidator >
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
RegularExpress ionValidator 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+!hotm ail)([-/]\w+)*\.\w+(-.]\w+)*

TIA
Sep 12 '06 #3
Hiii
Fine i agree with u. My method will not be efficient if its many
domains.U can give alert by using java script. that is, if its equal to
yahoo.com or gmail.com, generate alert..

or try this:

ControlToValida te="to"
ValidationExpre ssion=".*@yahoo .com*\..*"
ErrorInfo="<sma ll>Invalid email address.</small>"
Display="Dynami c">
</asp:RegularExpr essionValidator >

Hope this works, I am still doing R&D in google, if i find something
much better, i will post. U first try this for yahoo.com. If it works
for yahoo, we will add other domains like gmail etc etc...

Cheers
Raghav
Sjaakie wrote:
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:RegularExp ressionValidato r
id="xyz" runat="server"
ErrorMessage="M essage."

ValidationExpre ssion="^(([a-zA-Z]:)|(\\{2}\w+)\$ ?)(\\(\w[\w].*))(.doc|.rtf| .txt)$"
ControlToValida te="Message"></asp:RegularExpr essionValidator >
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
RegularExpressi onValidator 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+!hotm ail)([-/]\w+)*\.\w+(-.]\w+)*

TIA
Sep 12 '06 #4
ValidationExpre ssion=".6a.6\.. 6"

after posting it did display properly, so writing again

in above string replace
6 with------------->*(asteric)
a with-------------->@(at)
just after a write yahoo.com and becareful with .(dot) marks, no space
try it
Raghav..


raghav wrote:
Hiii
Fine i agree with u. My method will not be efficient if its many
domains.U can give alert by using java script. that is, if its equal to
yahoo.com or gmail.com, generate alert..

or try this:

ControlToValida te="to"
ValidationExpre ssion=".*@yahoo .com*\..*"
ErrorInfo="<sma ll>Invalid email address.</small>"
Display="Dynami c">
</asp:RegularExpr essionValidator >

Hope this works, I am still doing R&D in google, if i find something
much better, i will post. U first try this for yahoo.com. If it works
for yahoo, we will add other domains like gmail etc etc...

Cheers
Raghav
Sjaakie wrote:
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:RegularExp ressionValidato r
id="xyz" runat="server"
ErrorMessage="M essage."
>
ValidationExpre ssion="^(([a-zA-Z]:)|(\\{2}\w+)\$ ?)(\\(\w[\w].*))(.doc|.rtf| .txt)$"
>
>
ControlToValida te="Message"></asp:RegularExpr essionValidator >
>
>
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
>RegularExpress ionValidator 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+!hotm ail)([-/]\w+)*\.\w+(-.]\w+)*
>>
>TIA
>
Sep 12 '06 #5
raghav wrote:
Hiii
Fine i agree with u. My method will not be efficient if its many
domains.U can give alert by using java script. that is, if its equal to
yahoo.com or gmail.com, generate alert..

or try this:

ControlToValida te="to"
ValidationExpre ssion=".*@yahoo .com*\..*"
ErrorInfo="<sma ll>Invalid email address.</small>"
Display="Dynami c">
</asp:RegularExpr essionValidator >

Hope this works, I am still doing R&D in google, if i find something
much better, i will post. U first try this for yahoo.com. If it works
for yahoo, we will add other domains like gmail etc etc...

Cheers
Raghav
Sjaakie wrote:
>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
>>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
automatical ly 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
RegularExpre ssionValidator 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+!hotm ail)([-/]\w+)*\.\w+(-.]\w+)*

TIA
Raghav,
I finally managed to write an expression that detects hotmail, yahoo and
gmail addresses:

..*@(?!hotmail) (?!gmail)(?!yah oo).*

Thanks for your help!
Sep 13 '06 #6
Hii
Thats really nice!!! i will also copy this string for future
reference:-)

Best Wishes
Raghav

Sjaakie wrote:
raghav wrote:
Hiii
Fine i agree with u. My method will not be efficient if its many
domains.U can give alert by using java script. that is, if its equal to
yahoo.com or gmail.com, generate alert..

or try this:

ControlToValida te="to"
ValidationExpre ssion=".*@yahoo .com*\..*"
ErrorInfo="<sma ll>Invalid email address.</small>"
Display="Dynami c">
</asp:RegularExpr essionValidator >

Hope this works, I am still doing R&D in google, if i find something
much better, i will post. U first try this for yahoo.com. If it works
for yahoo, we will add other domains like gmail etc etc...

Cheers
Raghav
Sjaakie wrote:
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
>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
automaticall y 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
RegularExpres sionValidator 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+!hotm ail)([-/]\w+)*\.\w+(-.]\w+)*

TIA

Raghav,
I finally managed to write an expression that detects hotmail, yahoo and
gmail addresses:

.*@(?!hotmail)( ?!gmail)(?!yaho o).*

Thanks for your help!
Sep 13 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2975
by: Frank.Sebesta | last post by:
I have a wedge mag stripe reader that I swipe when ask to input information in a query. How do I filter the unwanted characters. Apparently there are two mag stripes that are read every time I swipe the card. The first line has the name information and the second line has the number that I want to use. The number looks like this when I swipe a card. %00123478? I need to filter out the % and the ?
1
2798
by: mg | last post by:
Does someone have RegularExpression code (C# WebForm) for server-side validation of Date (mm/dd/yyyy) ... including leap year?
2
1480
by: Konrad | last post by:
Hi Can you point examples in .NET of filtering (avoiding) displaying web pages with unwanted content on machine with ie? Thanks Konrad
1
1055
by: fabrice | last post by:
Hello, In a search form, i want to permit few characters (see below) and some signs as - _ / , . So thios my RegularExpression and it works. ValidationExpression="{4,20}" But i'd would like to permit the sign ? in my string, but only one or two
1
1927
by: Nicola Farina | last post by:
Hi all, i've a form with a textbox that user "must" fill with a password. I want to check if there's a password inside, and if it's between 6 an 8 chars. I've placed a regularexpression validator pointing this textbox and with the following expression: \w{6,8}
2
1235
by: Fabio | last post by:
Hi all, I have this simple string for example: anything<font>catch this</font> and I need a regularexpression to Catch "catch this" so, I can use this pattern: ">+"
3
1753
by: Arpan | last post by:
Consider the following code which validates a TextBox using RegularExpression: <form id="form1" runat="server"> <asp:TextBox id="txt1" runat="server"/> <asp:RegularExpressionValidator ControlToValidate="txt1" ValidationExpression="{5}-{4}|{5}" ErrorMessage ="Invalid Input" Display="Dynamic" runat="server"/> <asp:Button id="btn" Text="SUBMIT" runat="server"/> </form>
1
1530
by: Arpan | last post by:
Using RegularExpression, I want to validate a TextBox so that the TextBox accepts only 8-digit numbers. This can be done with the following RegularExpression: {8} But how do I validate the TextBox so that it accepts 8-digit number or more than 8-digit numbers using RegularExpressions? Also how do I validate the TextBox so that it accepts 8 or more than
1
2041
by: prp | last post by:
hi all, I have a problem.Suppose I use a regularexpression validator for zip code. An User fill wrong entry in the relevant textbox then regularexpression validator fires.but user did not correct the entry and press the signup button . At that time i want setfocus on that zip textbox. all such things happen in asp.net and i want javascript for the setfocus.
3
5716
by: =?iso-8859-1?Q?Johnny_J=F6rgensen?= | last post by:
I've got a textbox where I filter the input in the KeyPress event to allow only certain characters. However, If the user cuts and pastes a text into the textbox, all text is entered - not only the characters allowed. That doesn't surprise me, but what is the best way of avoiding that and still only allowing certain characters even when pasting??? TIA, Johnny J.
0
9627
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10060
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9922
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8951
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7469
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5492
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2859
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.