So I need to check a string (url) against a list of reg ex wildcard values to see if there is a match. I will be intercepting an HTTP request and checking it against a list of pre-configured values and if there is a match, do something to the URL. Examples:
Request URL: http://www.stackoverflow.com
Wildcards: *.stackoverflow.com/
*.stack*.com/
www.stackoverflow.*
Are there any good libraries for C++ for doing this? Any good examples would be great. Pseudo-code that I have looks something like:
std::string requestUrl = "http://www.stackoverflow.com";
std::vector<string> urlWildcards = ...;
BOOST_FOREACH(string wildcard, urlWildcards) {
if (requestUrl matches wildcard) {
// Do something
} else {
// Do nothing
}
}
Thanks a lot.
Code from MSDN (http://msdn.microsoft.com/en-us/library/zcwwszd7(v=vs.80).aspx).