Some handy Regular Expressions


Some handy regex patterns for grabbing different bits of gubbins and stuff;

EmailAddress:
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$

Postcode:
^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][ABDEFGHJLNPQRSTUWXYZabdefghjlnpqrstuwxyz]{2}$

HTML Tags:
<(.|\n)*?>

HTML Tags except for the BR tag:
(\<)(?!br(\s|\/|\>))(.*?\>)

Related posts:

  1. No comments yet.
(will not be published)