Commonly Used Regular Expressions

image thumb Commonly Used Regular Expressions Ok, the following is mainly just a note for me.  So, excuse the extreme geekinessÂ…

Below is a list of regular expressions that may be useful if you do any programming:

 

 

 

 

 

  • A regular expression that matches any HTML tag
    • /^<([a-z]+)([^<]+)*(?:>(.*)</1>|s+/>)$/
  • A regular expression that matches an IP Address
    • /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
  • A regular expression that matches a URL
    • /^(https?://)?([da-z.-]+).([a-z.]{2,6})([/w .-]*)*/?$/
  • A regular expression that matches an Email Address
    • /^([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$/

via Nettuts

linkedin Commonly Used Regular Expressionsshare save 171 16 Commonly Used Regular Expressions

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>