tags:

views:

77

answers:

3

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
+1  A: 

Nope, there isn't one.

On windows, you could take a look at the IsValidURL() function

JasonV
Not cross platform, but a close enough answer for now. I guess the only cross platform solution is to use regex patterns.
Jakobud
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