Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Need help understanding regular expression

Reply
Thread Tools

Need help understanding regular expression

 
 
Joe
Guest
Posts: n/a
 
      08-02-2005
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="^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
ErrorMessage="Invalid Email address."
Display="None">
</asp:RegularExpressionValidator>

Can someone explain me why the email address http://www.velocityreviews.com/forums/(E-Mail Removed) is
considered an invalid email address?

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

Thanks,

Joe

 
Reply With Quote
 
 
 
 
Chris Hohmann
Guest
Posts: n/a
 
      08-02-2005
"Joe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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="^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
> ErrorMessage="Invalid Email address."
> Display="None">
> </asp:RegularExpressionValidator>
>
> Can someone explain me why the email address (E-Mail Removed) 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


 
Reply With Quote
 
 
 
 
Tim Slattery
Guest
Posts: n/a
 
      08-03-2005
Joe <(E-Mail Removed)> wrote:

>Hi,
>
>I have been using a regular expression that I dont uite understand to
>filter the valid email address. My regular expression is as follows:
>
> <asp:RegularExpressionValidator id="valValidEmail"
>runat="server"
> ControlToValidate="txtEmail"
>
>ValidationExpression="^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
> ErrorMessage="Invalid Email address."
> Display="None">
> </asp:RegularExpressionValidator>
>
>Can someone explain me why the email address (E-Mail Removed) 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 RegularExpression 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)
(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seek xpath expression where an attribute name is a regular expression GIMME XML 3 12-29-2008 03:11 PM
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" Adem C++ 42 11-04-2008 12:39 PM
Matching abitrary expression in a regular expression =?iso-8859-1?B?bW9vcJk=?= Java 8 12-02-2005 12:51 AM
Need help understanding regular expression =?Utf-8?B?Sm9l?= ASP .Net 3 08-03-2005 01:10 AM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM



Advertisments