Skip to content

Instantly share code, notes, and snippets.

@aziz
Created June 9, 2011 19:33
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 aziz/1017517 to your computer and use it in GitHub Desktop.
Save aziz/1017517 to your computer and use it in GitHub Desktop.
Often used regular expressions
# Often used regular expressions - Cheatsheet
EMAIL = /\A[a-z0-9\+\-_\.]+@[a-z0-9]+[a-z0-9\-\.]*[a-z0-9]+\z/i
HOST = /\A[a-z0-9]+[a-z0-9\-\.]*[a-z0-9]+\z/i
URL = /(http|https):\/\/[\w\-_]+(\.[\w\-_]+)*([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?/
HEX_COLOR = /\A([a-fA-F0-9]{3}){1,2}\z/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment