
Robert Dailey wrote:
Hey Eric,
I ended up using the method you proposed anyway mainly because I love boost so much and also because you did all of the work for me, so I couldn't let that go to waste. <snip>
Great! You might want to also provide the following overload with a simpler interface. It traffics in strings rather than iterators, and just invokes the more general iterator-based algorithm that I sent earlier: template<typename Char, typename Format> inline std::basic_string<Char> regex_grep( std::basic_string<Char> const &str , xpressive::basic_regex< typename std::basic_string<Char>::const_iterator > const &re , Format format , xpressive::regex_constants::match_flag_type flags = xpressive::regex_constants::match_default ) { std::basic_string<Char> result; regex_grep( std::back_inserter(result) , str.begin() , str.end() , re , format , flags ); return result; } Now you can simply say "out = regex_grep(in, rex, formater())". As with much template code, it looks more daunting at first than it really is.
In any case, I split up your source a little and placed them into more generic hpp files and I've put that into the engine for our game. You were very helpful, and I thank you. I'll submit a patch later on when I have time to mess with it. For future reference, where can I submit patches? Thanks again.
You can submit patches at the same place you file bugs and make feature requests: svn.boost.org. Use the "New Ticket" button and follow the instructions. If you go this route, I'm much more likely to accept the patch if it comes with tests and documentation. I'll also say that the name "regex_grep" is lousy. I was thinking that Boost.Regex had this functionality with that name, but I was mistaken. -- Eric Niebler Boost Consulting www.boost-consulting.com