Suppose I would like to match for the following pipe-delimited strings:
std::string re("a|*|c");
std::string x("a|b|c");
std::string y("a|c|d");
does_match( re, x ); // want to return TRUE
does_match( re, y ); // want to return FALSE
what is the best way to implement does_match() using boost::regex?
I think I may be running into issues with escaping pipes and stars. Note that I don’t care about the actual matches: I just want an easy-to-use interface to does_match() to tell me if I have a match.
In particular, I hope to get this working without having to use a ton of escapes for pipes and stars. I don’t care about other more general uses of regex – if I can use pipe-delimiters and * for wildcards, that’s sufficient.
Maybe I should do a transform inside does_match to make boost::regex happy? Or perhaps my entire approach is bad (like I should be using some kind of strsplit() instead?).
Ok, I think I’m barking up the wrong tree by attempting to solve this with boost::regex() – boost::split() is probably more appropriate.