Skip to content

Instantly share code, notes, and snippets.

@granolocks
Created May 3, 2012 01:30
Show Gist options
  • Select an option

  • Save granolocks/2582419 to your computer and use it in GitHub Desktop.

Select an option

Save granolocks/2582419 to your computer and use it in GitHub Desktop.
Useful Regex
VALID_IP_ADDRESS = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/
VALID_HOSTNAME = /^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment