diff --git a/libs/editor/xml_feature.cpp b/libs/editor/xml_feature.cpp index 8813e851f..ea9a4caac 100644 --- a/libs/editor/xml_feature.cpp +++ b/libs/editor/xml_feature.cpp @@ -16,7 +16,7 @@ #include "base/timer.hpp" #include -#include +#include #include #include @@ -712,20 +712,21 @@ void XMLFeature::OSMBusinessReplacement(uint32_t old_type, uint32_t new_type) std::string name = GetTagValue("name"); // Remove OSM tags using the list from keys_to_remove.hpp - std::string regexPattern; + static const boost::regex regex([] { + std::string regexPattern; - for (auto const & key : kKeysToRemove) + for (auto const & key : kKeysToRemove) + { + if (!regexPattern.empty()) + regexPattern.append("|"); + regexPattern.append(key); + } + return regexPattern; + }()); + + ForEachTag([this](std::string_view key, std::string_view /*value*/) { - if (!regexPattern.empty()) - regexPattern.append("|"); - regexPattern.append(key); - } - - std::regex regex(regexPattern); - - ForEachTag([& regex, this](std::string_view key, std::string_view /*value*/) - { - if (std::regex_match(key.begin(), key.end(), regex)) + if (boost::regex_match(key.begin(), key.end(), regex)) RemoveTag(key); });