[1] Email:
$email_regexp = '^([_a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+)(\.[a-zA-Z0-9-]+)*
(\.[a-zA-Z]{2,4})$';
[2] UK postcode:
$postcode_regexp = '^[A-Z]{1,2}[0-9]{1,2}[A-Z]{0,1}[[:space:]][0-9]{1}[A-Z]{2}';
[3] Birthday:
$date_regexp = '/^(0[1-9]|[12][0-9]|3[01])\D(0[1-9]|1[012])\D
(19[0-9][0-9]|20[0-9][0-9])$/';
Sunday, 19 August 2007
PHP Data Validation Regexp (email, postcode, date)
Posted by Alex Zang at 8:50 pm
Labels: PHP, Sample Code
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment