X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Furl_recipe.cpp;h=7a8f28f570ad65c200deca9bdb099aac19af5221;hb=f361b19c06d801535a66ed1cd77b75e496b85426;hp=80769281658454a8c3f88f14d421370aadad8895;hpb=e5329397729e8959a821c6956f75012372fc0a77;p=metaproxy-moved-to-github.git diff --git a/src/url_recipe.cpp b/src/url_recipe.cpp index 8076928..7a8f28f 100644 --- a/src/url_recipe.cpp +++ b/src/url_recipe.cpp @@ -117,15 +117,19 @@ std::string mp_xml::url_recipe_handle(xmlDoc *doc, std::string recipe) break; } } - boost::regex::flag_type b_mode = boost::regex::perl; - if (mode.find_first_of('i') != std::string::npos) - b_mode |= boost::regex::icase; - boost::regex e(pattern, b_mode); - - boost::match_flag_type match_mode = boost::format_first_only; - if (mode.find_first_of('g') != std::string::npos) - match_mode = boost::format_all; - result += regex_replace(text, e, replacement, match_mode); + if (pattern.length() == 0) + result += text; + else + { + boost::regex::flag_type b_mode = boost::regex::perl; + if (mode.find_first_of('i') != std::string::npos) + b_mode |= boost::regex::icase; + boost::regex e(pattern, b_mode); + boost::match_flag_type match_mode = boost::format_first_only; + if (mode.find_first_of('g') != std::string::npos) + match_mode = boost::format_all; + result += regex_replace(text, e, replacement, match_mode); + } } } return result;