Here is a list I put together a while back to keep for reference whenever I do validation:
First Name or Last Name
Email
Phone or Mobile
Postcode for Australia
Postcode for the US
Postcode for the UK
Date: Day
Date: Month
Date: Year
CSV File with comma delimited text
There is also an incredibly useful tool that a colleague of mine, Ross Donald, built that had helped me out so much in the past:
http://www.radsoftware.com.au/regexdesigner/
First Name or Last Name
^[a-zA-Z-'\s]*$
Email
^[a-zA-Z0-9]+[a-zA-Z0-9\'._%+-]*@[a-zA-Z0-9_-]+[.]%7b1%7d[a-zA-Z0-9_-]+ [a-zA-Z0-9._-]*[a-zA-Z0-9]+$">*@[a-zA-Z0-9_-]+[.]{1}[a-zA-Z0-9_-]+ [a-zA-Z0-9._-]*[a-zA-Z0-9]+$
Phone or Mobile
^[0-9\(\)\-+\s]*$
Postcode for Australia
^[0-9]{4}$
Postcode for the US
^[0-9]{5}$
Postcode for the UK
^[a-zA-Z]{1,2}[0-9]{1,2}[a-zA-Z]?[\s]*[0-9]{1}[a-zA-Z]{2}$
Date: Day
^([0-2]*[1-9]{1}|3[0-1]{1})$
Date: Month
^([0]*[1-9]{1}|1[0-2]{1})$
Date: Year
^(19[0-9][0-9]|20[0-9][0-9])$
CSV File with comma delimited text
,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))
No comments :
Post a Comment