473,887 Members | 2,301 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help understanding regular expression

Joe
Hi,

I have been using a regular expression that I don’t uite understand to
filter the valid email address. My regular expression is as follows:

<asp:RegularExp ressionValidato r id="valValidEma il"
runat="server"
ControlToValida te="txtEmail"

ValidationExpre ssion="^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
ErrorMessage="I nvalid Email address."
Display="None">
</asp:RegularExpr essionValidator >

Can someone explain me why the email address jo*******@Z-5com.com is
considered an invalid email address?

Also can someone explain me what the above regular expression means?

Thanks,

Joe

Aug 2 '05 #1
2 1816
"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:35******** *************** ***********@mic rosoft.com...
Hi,

I have been using a regular expression that I don't uite understand to
filter the valid email address. My regular expression is as follows:

<asp:RegularExp ressionValidato r id="valValidEma il"
runat="server"
ControlToValida te="txtEmail"

ValidationExpre ssion="^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
ErrorMessage="I nvalid Email address."
Display="None">
</asp:RegularExpr essionValidator >

Can someone explain me why the email address jo*******@Z-5com.com is
considered an invalid email address?

Also can someone explain me what the above regular expression means?

Thanks,

Joe

^ = Start of Line
([_a-z0-9-]+) = One or more underscores, alphanumeric or dashes
(\.[_a-z0-9-]+)* = Zero or more instances of the following; a period
followed by one or more underscores, alphanumeric or dashes
@ = the "at" sign
([a-z0-9-]+) = One or more alphanumeric or dashes
(\.[a-z0-9-]+)* = Zero or more instances of the following; a period followed
by one or more alphanumeric or dashes
(\.[a-z]{2,4}) = A period followed by 2, 3 or 4 letters.
$ = End of Line
Aug 2 '05 #2
Joe <Jo*@discussion s.microsoft.com > wrote:
Hi,

I have been using a regular expression that I don’t uite understand to
filter the valid email address. My regular expression is as follows:

<asp:RegularExp ressionValidato r id="valValidEma il"
runat="serve r"
ControlToValida te="txtEmail"

ValidationExpr ession="^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
ErrorMessage="I nvalid Email address."
Display="None">
</asp:RegularExpr essionValidator >

Can someone explain me why the email address jo*******@Z-5com.com is
considered an invalid email address?


The RE doesn't allow upper-case letters, so the "Z" after the @ sign
is probably the culprit.

I can't tell from this snippet exactly how this RE is being applied.
VBScript's RegularExpressi on object has an "IgnoreCase " property. If
that's set to "true" before the "test" method is run then case doesn't
matter. This snippet doesn't tell me whether that's being done or not,
but I can't find any other reason for it to fail.

There's some Regular Expression documentation here:
http://msdn.microsoft.com/library/de...propattern.asp

Chris Hohmann's post describes what your RE is looking for. No need
for me to repeat that.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls. gov
Aug 3 '05 #3

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

Similar topics

2
2341
by: Joh | last post by:
Hello, (sorry long) i think i have missed something in the code below, i would like to design some kind of detector with python, but i feel totally in a no way now and need some advices to advance :( data = "it is an <atag> example of the kind of </atag> data it must handle and another kind of data".split(" ")
4
5189
by: Buddy | last post by:
Can someone please show me how to create a regular expression to do the following My text is set to MyColumn{1, 100} Test I want a regular expression that sets the text to the following testMyColumn{1, 100}Test Basically I want the regular expression to add the word test infront of the
3
2312
by: Joe | last post by:
Hi, I have been using a regular expression that I don’t uite understand to filter the valid email address. My regular expression is as follows: <asp:RegularExpressionValidator id="valValidEmail" runat="server" ControlToValidate="txtEmail" ValidationExpression="^(+)(\.+)*@(+)(\.+)*(\.{2,4})$"
18
3051
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How ??
3
278
by: moondaddy | last post by:
I need to rename file names with a specific naming convention which includes adding a SKU number at the end of the file name and I would like to use a regular expression to do this, but I don't even know where to start on this one. For example say my file name is MyFileName.jpg and my SKU number is 1234. I need to rename the file to MyFileName---1234.jpg where the sku number gets prefixed with "---". However, since there will be a...
18
2039
by: yawnmoth | last post by:
Say I have the following script: <? $string = 'test'; if (eregi("^+$",$string)) { echo 'matches!'; } else {
7
3836
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I want to avoid that. My question here is if there is a way to pass either a memory stream or array of "find", "replace" expressions or any other way to avoid multiple copies of a string. Any help will be highly appreciated
3
1355
by: Lucky | last post by:
hi guys, i'm practising regular expression. i've got one string and i want it to split in groups. i was trying to make one regular expression but i didn't successed. please help me guys. i'm using .NET 2.0's Regular expression class. here is the string.
25
5194
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART (CONDUCTION DEFECT) 37.33/2 HEART (CONDUCTION DEFECT) WITH CATHETER 37.34/2 " the expression is "HEART (CONDUCTION DEFECT)". How do I gain access to the expression (not the matches) at runtime? Thanks, Mike
14
2291
by: Chris | last post by:
I need a pattern that matches a string that has the same number of '(' as ')': findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = Can anybody help me out? Thanks for any help!
0
9957
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
9799
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11173
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...
0
10434
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
7143
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4633
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
2
4239
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3245
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.