Skip to content

Instantly share code, notes, and snippets.

@arjenblokzijl
Created July 27, 2015 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arjenblokzijl/b0bd9d2db524b42c6a4b to your computer and use it in GitHub Desktop.
Save arjenblokzijl/b0bd9d2db524b42c6a4b to your computer and use it in GitHub Desktop.
War tested PHP regular expressions
Dutch Chamber of Commerce > /(?<!\d)\d{8}(?!\d)/
Dutch postal code > /^[1-9][0-9]{3}[\s]?[A-Za-z]{2}$/i
General URL > @(https?|ftp)://(-\.)?([^\s/?\.#-]+\.?)+(/[^\s]*)?$@i
LinkedIn URL > /(ftp|http|https):\/\/?((www|\w\w)\.)?linkedin.com(\w+:{0,1}\w*@)?(\S+)(:([0-9])+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment