-
URL checker
Hi there,
Do you have any ideas about how to construct a simple URL checker ? Not one that actually checks server side to see whether or not the domain name actually exists.
User must enter something like www.domain_name.com
At its simplest level is it sufficient to check that two periods have been etered ?
I am not looking for source code !
:)
regards,
bigSteve
-
Tricky, this is valid and only has one dot
http://motherboards.org/
-
hmmmmm regular expression comes to my mind...
-
Doesn't the boost library have a regex library? An english teacher at my school who progams has been telling me all year to learn regular expressions, they do seem to come in handy.
-
URL checker
unanimous replied:
Doesn't the boost library have a regex library?
What does this sentence mean ?
bigSteve
-
Boost is a C++ library located at Boost.org. Its a very good andvery useful library and the creators are trying to make it part of the new C++ standards if I remember correctly. Regex is the abbreciated form of regular expressions which vasanth mentioned earlier.
-
Checking for two periods is redundant, since sub-domains (which www is) don't validate domain names.
I guess, logically, it might be done as such:
- Locate the end of the TLD (which would be either a forward-slash (domain.com/index.html), or nothing (domain.com));
- Check every character up-until is valid (i.e. no spaces, etc.);
-
Thanks for all your suggestions,
bigSteve
-
Well this on another wave length then what you were going for, but if you have an active connection and wanted to see if the URL was valid, try making a connection to it, not visible mind you... and then check the host response.. kinda like using sockets...
Safe Coding...
-
It would be far quicker and resource friendly to check for invalid characters prior to resolving.
-
Yhea your correct it would not be friendly, but it is the only true way to make sure a URL is valid. But if you just want to check URL syntax then you can.. It was an idea... not a perfect resolution.