Regular expression for validating email address in asp net

As always, the source code is available to download at the bottom of the article.

regular expression for validating email address in asp net-54regular expression for validating email address in asp net-51regular expression for validating email address in asp net-62

to avoid any erroneous data to be inserted into the database. So let us learn some basics because I have written this article only focusing on beginners and students. Example I hope you now understand the basics of validation in Java Script, now let us create the one sample web application that demonstrates how to do validation.

In this article we will learn about client-side validation that is done using Java Script. In the preceding syntax function is the keyword provided by the Java Script to declare a function and the Vildate Data() is the function name, now write the code inside the function as in the following.

Here is an example where we require a 4 digit number - nothing else is acceptable: The only new attribute we use, is the validationexpression.

This attribute simply holds the Regular Expression which should be used to validate the field.

Net control's values in variables so it cannot be repeated again and again in our function the email Exp variable holds the pattern of the email id in the form of a regular expression.

Now add the condition to ensure that all controls have a value, if the values are not entered in the form control then it will show a message.The condition will be as follows: is shown to the user and finally we are returning false; that is very important.Importantance of returning false It's very important to use the return false statement after the condition block that return false so if validation determines that the business requirements are not met then the form cannot be submitted.If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices. Now you can ask questions directly to me on my new site ASPForums. Error Message="Please enter in email format." Control To Validate="txt Email" Set Focus On Error="true" Validation Expression="\w ([- .']\w )*@\w ([-.]\w )*\.\w ([-.]\w )*" Validation Group="A" Fore Color="" Css Class="Validation-Msg" Display="Dynamic"you can use client side validations or server side validations for regular expressions..better to use client side validations..check out this link it may helps you Sayyad .