mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Fix IfcUtil::wildcard_string_to_regex()
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user