Re: [Boost-users] Posix extended regexp
Thanks a lot for the help John, it works now regards Manish
john@johnmaddock.co.uk 5/6/2004 1:58:27 AM >>>
What am I doing wrong?
Here's my short matching function:
bool MatchRegExp(const std::string& matchThis, const std::string& againstThis) { try { const boost::regex e(againstThis);//, boost::regex_constants::icase); return boost::regex_match(matchThis, e, boost::regex_constants::extended); } catch(boost::bad_expression be) { return false; }
}
You're passing the wrong constants in all the wrong places, it should have been: const boost::regex e(againstThis, boost::regex::extended); return boost::regex_match(matchThis, e, boost::match_default); You can omit the match_default flag (since it's the default anyway), and if you wanted case insensitive matching it would have been: const boost::regex e(againstThis, boost::regex::extended | boost::regex::icase); Oh, and don't forget to check the difference between regex_match and regex_search (the match version requires all of the text to match). John. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hello all, Has anyone got some good examples of using the dynamic_bitset and its member function like append etc? I am having a little trouble learning how to use this new set of class. System, Mac OSX, c++, xcode. Thanks Regards Michael
Hello all, Has anyone got some good examples of using the dynamic_bitset and its member function like append etc? I am having a little trouble learning how to use this new set of class. System, Mac OSX, c++, xcode. Thanks Regards Michael
participants (2)
-
Manish Madan
-
Michael Short