RSS

Special Characters valiadtions For Name Fields and Email Using RegularExp

02 Mar

Hi folks,

Assume when we are implementing a JSP page which contains fields like FirstName, LastName and Email, we need to do the server side validations not to allow special characters.
Here is the simple regular expressions which reduces your job. Below are the regular expressions for Name Fields and Email.

Name Fields : ^[a-zA-Z0-9`\’\- .]*$

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

Happy Coding!.

Get glued to know more updates.

Have a nice day 🙂

Advertisements
 
Leave a comment

Posted by on March 2, 2013 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: