regex filter: log the problematic strings so they can be identified

This commit is contained in:
Andrzej Rybczak
2015-08-15 17:02:26 +02:00
parent 51768b9f7a
commit dbe655d159

View File

@@ -30,6 +30,7 @@
#endif // BOOST_REGEX_ICU
#include <cassert>
#include <iostream>
namespace Regex {
@@ -64,8 +65,9 @@ inline bool search(StringT &&s, const Regex &rx)
boost::regex_search
# endif // BOOST_REGEX_ICU
(std::forward<StringT>(s), rx);
} catch (std::out_of_range &) {
} catch (std::out_of_range &e) {
// Invalid UTF-8 sequence, ignore the string.
std::cerr << "Regex::search: error while processing \"" << s << "\": " << e.what() << "\n";
return false;
}
}