Create a gist now

Instantly share code, notes, and snippets.

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