Created
February 20, 2013 07:54
-
-
Save descovi/4993768 to your computer and use it in GitHub Desktop.
Validate a url with http or without / Validare una url con http sia senza http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RegEx: is from http://stackoverflow.com/a/13311941/632478 | |
# Rubular: http://rubular.com/r/cdkLxAkTbk | |
validates :url, format: { with: /^(http|https):\/\/|[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}(:[0-9]{1,5})?(\/.*)?$/ix } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment