Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
User Journal

Journal inerte's Journal: URL validation 1

With the launch of a new website, http://www.miniurl.com.br (which works like tinyurl.com), I've learned one thing, despite many claims that is possible: You can't validate web addresses. Sure, an URL needs the scheme, like http:// or ftp://, but browsers will load www.google.com or google.com just fine, and that's actually what users are entering on the app. Non-USA domains have strange TLD, so coming up with a regex for them it's a no-no. Then you have sub-servers, sub-domains, directories, query strings, custom DNS rules (some URLs with non-ascii characters actually resolve around the world)... a bunch of stuff. Just venting the frustation... because some people clearly put "test" strings on the form and hit submit, and now the DB has invalid URLs, but such is life...
This discussion has been archived. No new comments can be posted.

URL validation

Comments Filter:
  • Yes, you can validate URL's as easily as anything. They have a defined schema. The problem is that the validation is very complex. If you want a sense of what I'm talking about have a look at the book "Mastering Regular Expressions" in which there is an email address verification regex that is constructed programatically (because the actual regex is so huge and confusing, 6598 characters to be exact) The relevant code is here http://examples.oreilly.com/regex/readme.html [oreilly.com]

    The better question is does a full va

With your bare hands?!?

Working...