Case issue with e-mail validator?

Apr 24, 2009 at 6:40 PM
Wondering if anyone else is having validation issues when a UPPER case character is part of
an e-mail address?
My validator is choking on any UPPER case that I use in the address...?
I've tried two regex values with no luckso far.

What am I doing wrong?

Thanks,
Rich
May 1, 2009 at 3:09 PM
Impossible to say w/out actually seeing your regex, but try this one on for size...

^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$

May 1, 2009 at 4:07 PM

thanks mate.

I'm re-tasked for the monment, but as soon as I get back on that one,I'll scope it out!

Rich

 

May 8, 2009 at 7:21 PM

hmm, no luck: any clue what I'm doing wrong below?

 

 

 

 

 

 

 

 

 

<font color="#a31515">

 

</font>

 

<!---E-MAIL-->

<font color="#a31515">

 

</font>

 

<TextBlock Text="E-mail"></TextBlock><font color="#a31515">

 

</font>

 

<TextBox Width="200" HorizontalAlignment="Left" x:Name="txt_email" Text= ""><font color="#a31515">

 

</font>

 

<slv:ValidatorService.Validator><font color="#a31515">

 

</font>

 

<!--slv:RegexValidator IsRequired="True" x:Name="txt_valid_email" Expression= "^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$" ManagerName="Group1" ErrorMessage="Must be an email address"/-->

<font color="#a31515">

 

</font>

 

<slv:RegexValidator IsRequired="True" x:Name="txt_valid_email" Expression= "^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$" ManagerName="Group1" ErrorMessage="Must be an email address"/><font color="#a31515">

 

</font>

 

</slv:ValidatorService.Validator><font color="#a31515">

 

</font>

 

</TextBox>

 

 

 

 

<font color="#a31515">

 

</font>

 

 

 

 

May 14, 2009 at 6:31 PM

What exactly is it doing wrong? I assume it's not the upper-case issue anymore, as you can see from the regex above that it supports upper-case. Here's a simple example...

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

<

</font></font><font size="2" color="#0000ff">

 

</font>

slv:ValidatorManager x:Name="MyGroup" />

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

<

</font></font><font size="2" color="#0000ff">

 

</font>

TextBox x:Name="tbEmailAddress" MaxLength="50">

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font>
<font size="2" color="#a31515">

 

</font>

<slv:ValidatorService.Validator>

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font>
<font size="2" color="#a31515">

 

</font>

<slv:RegexValidator Expression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$" ManagerName="MyGroup" ErrorMessage="A valid Email Address is required" IsRequired="True"/>

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font>
<font size="2" color="#a31515">

 

</font>

</slv:ValidatorService.Validator>

<font size="2" color="#a31515"><font size="2" color="#a31515">

 

</font></font>
<font size="2" color="#a31515">

 

</font>

</TextBox>

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

<

</font></font><font size="2" color="#0000ff">

 

</font>

Button x:Name="btnSubmit" Click="btnSubmit_Click" Content="Submit"  />

And the code-behind...

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

using

</font></font><font size="2" color="#0000ff">

 

</font>

Silverlight.Validators;

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

private

</font></font><font size="2" color="#0000ff">

 

</font>

void btnSubmit_Click(object sender, RoutedEventArgs e)

{

<font size="2">

 

</font>

List<ValidatorBase> validators = MyGroup.ValidateAll();<font size="2">

 

</font>

if (validators.Count == 0)

{

<font size="2">

//form is valid, do something...

</font>

}

}