Is there a easy standards-compliant way to check if a URL string is a valid format? Either through a specific URL-type class or maybe someone could show me how to do a regex validation of it?
A:
Is there a easy standards-compliant way to check if a URL string is a valid format?
There's nothing in the standard library.
sbi
2010-06-06 23:14:37
+1
A:
Nope, there isn't one.
On windows, you could take a look at the IsValidURL() function
JasonV
2010-06-06 23:19:35
Not cross platform, but a close enough answer for now. I guess the only cross platform solution is to use regex patterns.
Jakobud
2010-06-17 17:24:38
A:
As others have answered, there is no URL parsing or validation code in the C++ Standard Library nor in STL. Neither is there regular expression parsing.
The first place to look for a solved problem is Boost! Boost.Regex should have you on your way. And this answer has a great URL regular expression.
Johnsyweb
2010-06-07 20:05:06