Regular expressions (Perl-Compatible) in PHP

Even the most experienced developer needs to test if his regular expressions work as expected. That’s a little pain in the neck, but there is an interesting website developed by gskinner that can help us in that task:

http://gskinner.com/RegExr/

Another cool website to learn regular expressions: www.regular-expressions.info

Useful Regular Expressions

Regular expression for Validating Emails:

preg_match('/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/',$mail);

Leave a Reply

Your email address will not be published. Required fields are marked *