Fix IfcUtil::wildcard_string_to_regex()

This commit is contained in:
Stinkfist0
2016-03-07 23:15:29 +02:00
parent 0da0e63687
commit 50a467fda5
+5 -1
View File
@@ -149,10 +149,14 @@ bool IfcUtil::valid_binary_string(const std::string& s) {
boost::regex IfcUtil::wildcard_string_to_regex(std::string str)
{
std::string special_chars = "\\^.$|()[]*+";
// Escape all non-"*?" regex special chars
std::string special_chars = "\\^.$|()[]+/";
foreach(char c, special_chars) {
std::string char_str(1, c);
boost::replace_all(str, char_str, "\\"+ char_str);
}
// Convert "*?" to their regex equivalents
boost::replace_all(str, "?", ".");
boost::replace_all(str, "*", ".*");
return boost::regex(str);
}