瀏覽代碼

common: fix issue with regex_escape routine on windows (#14133)

bandoti 7 月之前
父節點
當前提交
2e89f76b7a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      common/common.cpp

+ 1 - 1
common/common.cpp

@@ -466,7 +466,7 @@ size_t string_find_partial_stop(const std::string_view & str, const std::string_
 
 std::string regex_escape(const std::string & s) {
     static const std::regex special_chars("[.^$|()*+?\\[\\]{}\\\\]");
-    return std::regex_replace(s, special_chars, "\\$0");
+    return std::regex_replace(s, special_chars, "\\$&");
 }
 
 std::string string_join(const std::vector<std::string> & values, const std::string & separator) {