PHP Programmer’s Of Bangladesh

Regular Expression Example

Posted by: Md. Masud on: October 1, 2007

Here i am providing some useful regular Expression which are acceptable by most of the web developers. I have found them in web.

Email Address validation

Expression: ^.+@[^\.].*\.[a-z]{2,}$

Description: Most email validation regexps are outdated and ignore the fact that domain names can contain any foreign character these days, as well as the fact that anything before @ is acceptable. The only roman alphabet restriction is in the TLD, which for a long time has been more than 2 or 3 chars (.museum, .aero, .info). The only dot restriction is that . cannot be placed directly after @. This pattern captures any valid, reallife email adress.

Date and Time

Expression: ^\d{1,2}\/\d{1,2}\/\d{4}$

Description: This regular expressions matches dates of the form XX/XX/YYYY where XX can be 1 or 2 digits long and YYYY is always 4 digits long.

You can have more information about RegX in the following site: http://regexlib.com/DisplayPatterns.aspx?cattabindex=1&categoryId=2

Leave a Reply

Where I was???

I was a PHP/MySQL web application developer in EVOKNOW INC from 1st July, 2006 to 5th Nov, 2007.

Blog Stats

  • 27,390 hits

What is the date?????

October 2007
S S M T W T F
« Sep   Nov »
 12345
6789101112
13141516171819
20212223242526
2728293031  

My Links in Del.icio.us

Google Adds