url-validation

(rails) validating URL help with regexp

i'm using the following to verify if a URL is formatted validly: validates_format_of :website, :with => URI::regexp(%w(http https)) however, it doesn't work when the url doesn't start with http:// or https://. Is there some similar way to validate URLs with URI::regexp (or URI) and make it include valid URLs that don't start with http...

(rails) weird problem with url validation

i'm trying to see if a url exists. here is my code for doing so: validate :registered_domain_name_exists private def registered_domain_name_exists if url and url.match(URI::regexp(%w(http https))) then begin # check header response case Net::HTTP.get_response(URI.parse(url)) when Net::HTTPSuccess then true ...

Need a regex to validating a Url and support %20 and ()

Hi, I'm currently using the following regular expression to validation URLs: ^(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~\/|\/)?(?#Username:Password)(?:\w+:\w+@)? (?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|edu|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:...

DJANGO URL Validation, I just want to see if the URL exists

I want to check in django if a URL exists and if it does I want to show something on screen. e.g: if URL_THAT_POINTS_TO_SOME_PDF exists SHOW_SOMETHING ...

URL Validation?

Does anyone know an up to date regular expression for validating URLs? I found a few on Google but they all allowed junk URL's i.e (www.google_com) when testing. My regular expression knowledge is not so vast, so I would hate to put something together that would fail under pressure. Thanks. ...