Regular Expression Validator

Feb 27, 2009 at 10:40 AM

Hi

    I have tried your demo page to check the validators. Its showing error for the email address hello@yahoo.com . I have tried few samples using Regular expression validator. But its not working as per my expectation. here is my sample code .

For Email address : 

 

<TextBox x:Name="txtEmail" Height="25" Width="150" Margin="550,-185,100,0">

 

 

<slv:ValidatorService.Validator>

 

 

<slv:RegexValidator IsRequired="True" Expression="^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$" ManagerName="Group1" ErrorMessage="Text must be an email address"/>

 

 

</slv:ValidatorService.Validator>

 

 

</TextBox>

 

For integer and decimal numbers:

<

TextBox x:Name="txtHRate" Height="25" Width="150" Margin="150,-65,500,0" >

 

 

<slv:ValidatorService.Validator>

 

 

<slv:RegexValidator IsRequired="True" Expression="([0-9]+)(\.?)([0-9]*)" ManagerName="Group1" ErrorMessage="Text must be an email address"/>

 

 

</slv:ValidatorService.Validator>

 

 

</TextBox>

 

May I know the reason for this

Thanks and Regards
Pradheepa