From 50a467fda58aaf5c77f355805a5a72ae1ad9eb22 Mon Sep 17 00:00:00 2001 From: Stinkfist0 Date: Mon, 7 Mar 2016 23:15:29 +0200 Subject: [PATCH] Fix IfcUtil::wildcard_string_to_regex() --- src/ifcparse/IfcUtil.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ifcparse/IfcUtil.cpp b/src/ifcparse/IfcUtil.cpp index efd0e8f64e..6721b35be2 100644 --- a/src/ifcparse/IfcUtil.cpp +++ b/src/ifcparse/IfcUtil.cpp @@ -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); }