Regular Expression
 
  I present you a collection of regular expressions (in the following simply re) which I realized by myself. In order to facilitate the comprehnsion of them, I provided a list of examples where the re is successfully applied and a list where not. This extra work is mainly intended for whom have not a deeper knowledge of re semantics.

email addresses

Description:
Validate email addresses.
Valid strings:
  • foo@foo.bar
  • foo.bar@foo.bar
  • foo.bar.com.it.es.uk.gov@foo.bar.com.it.es.uk.gov
  • foo.bar@foo.info
Invalid strings:
  • foo@bar@bar
  • foo@bar
  • foo@.bar.com
  • foo@bar.com.
  • foo@foo.bar.quad
  • fo;o@foo.bar
  • foo@fo;o.bar
^[-a-zA-Z0-9_.]+@[-a-zA-Z0-9_.]+[-a-zA-Z0-9_.]+\.([-a-zA-Z0-9_.]{2,3}|info|name)$

email addresses list

Description:
Validate a list of email addresses separeted by semicolons. See also email addresses re for reference.
Valid strings:
  • foo@foo.bar;foo@foo.bar
Invalid strings:
  • foo@foo.bar;;foo@foo.bar
  • foo@foo.bar;foo;foo@foo.bar
^[^;@]+@[^;@.]+[^;@]+\.([^;@.]{2,3}|info|name)	...split on the next line
(;[^;@]+@[^;@.]+[^;@]+\.([^;@.]{2,3}|info|name))*$

 


Valid XHTML 1.0!

Valid CSS!

home – e-mail
(C) 2003 by Giovanni Costagliola — All Rites Reversed