Monday, February 10, 2014


Postal Address 

set address "
   Mr S Tan
   #200, Broadway Av
   WEST BEACH SA 5024  

regexp {[a-zA-Z\d\s\-\,\#]+} $address new
puts $new

ZIP Code  

Date – accept date input in the mm/dd/yyyy or mm-dd-yyyy formats.

set date "31/01/1000"
regexp {(0[1-9]|1[0-9]|2[0-9]|3[0-1])/(0[1-9]|1[0-2])/(\d{4})} $date match
puts $match

Email Address  
[a-zA-Z0-9_\.\+-][email protected][a-zA-Z0-9-]+\.[a-zA-Z0-9-\.]+

set email "[email protected]"
regexp {[a-zA-Z0-9_]+.[0-9a-zA-Z_][email protected][a-z0-9A-Z_]+.[a-zA-Z_]+} $email match
puts $match

URL (Web domain)

set site ""
regexp {(http|https)://www.[a-z]+.[a-z]+} $site match
puts $match

Character Limit 

Phone Numbers  

Price (with decimal)  

Complex Password – only accept a string that has 1 uppercase alphabet, 1 lowercase alphabet, 2 digits and 1 special character. Also the minimum allowed length is 8 characters.