Yahoo Search

Search the web Search this site

Live Search

Google Search

Custom Search

Translate this Web Site to

Friday, November 21, 2008

Regular Expressions

In the resent past I had to write some simple regular expressions.
So thought of sharing them with you.

An EMail Address Validator

This will validate the entered EMail address.

A Password Validator

This will validate the password to have at least 1 alphabetic character and 1 numeric digit, and altogether the password will be more than 6 characters long.

A Telephone Number Valdator

This will expect the telephone number to be in international format. For example (0094 777 123456).

A Simple Length Validator

This will allow only only 200 or lesser characters for input.

A Length Validator Which Works With Linefeed (Return, Enter)

This will validate and allow only 500 input even in a multi line field when linefeed (enter) is used in between.

A Date Validator

(0[1-9]1[012])[- /.](0[1-9][12][0-9]3[01])[- /.](1920)\d\d

This will check for the date validness. The date format should be mm/dd/yyyy to correctly validate by this.

If the date format is required as yyyy/mm/dd then use the following.

(1920)\d\d[- /.](0[1-9]1[012])[- /.](0[1-9][12][0-9]3[01])

Following are some good sites that you can refer for regular expression help.,M1

1 comment:

jacker said...

Good Blog, I think I want to find me, I will tell my other friends, on all!
aoc power leveling