Use Strings::replace_all() instead of std::regex_replace()
MODIFY
src/vcpkg/commands.integrate.cpp
src/vcpkg/commands.integrate.cpp
@@ -93,9 +93,9 @@ namespace vcpkg::Commands::Integrate
</package>
)";
- std::string content = std::regex_replace(CONTENT_TEMPLATE, std::regex("@NUGET_ID@"), nuget_id);
- content = std::regex_replace(content, std::regex("@VCPKG_DIR@"), vcpkg_root_dir.string());
- content = std::regex_replace(content, std::regex("@VERSION@"), nupkg_version);
+ std::string content = Strings::replace_all(CONTENT_TEMPLATE, "@NUGET_ID@", nuget_id);
+ content = Strings::replace_all(std::move(content), "@VCPKG_DIR@", vcpkg_root_dir.string());
+ content = Strings::replace_all(std::move(content), "@VERSION@", nupkg_version);
return content;
}
@@ -308,7 +308,7 @@ CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s")",
System::println(System::Color::success, "Created nupkg: %s", nuget_package.string());
auto source_path = buildsystems_dir.u8string();
- source_path = std::regex_replace(source_path, std::regex("`"), "``");
+ source_path = Strings::replace_all(std::move(source_path), "`", "``");
System::println(R"(
With a project open, go to Tools->NuGet Package Manager->Package Manager Console and paste:

MODIFY
src/vcpkg/export.cpp
src/vcpkg/export.cpp
@@ -44,12 +44,12 @@ namespace vcpkg::Export
</package>
)";
- std::string nuspec_file_content = std::regex_replace(CONTENT_TEMPLATE, std::regex("@NUGET_ID@"), nuget_id);
- nuspec_file_content = std::regex_replace(nuspec_file_content, std::regex("@VERSION@"), nupkg_version);
+ std::string nuspec_file_content = Strings::replace_all(CONTENT_TEMPLATE, "@NUGET_ID@", nuget_id);
+ nuspec_file_content = Strings::replace_all(std::move(nuspec_file_content), "@VERSION@", nupkg_version);
nuspec_file_content =
- std::regex_replace(nuspec_file_content, std::regex("@RAW_EXPORTED_DIR@"), raw_exported_dir);
+ Strings::replace_all(std::move(nuspec_file_content), "@RAW_EXPORTED_DIR@", raw_exported_dir);
nuspec_file_content =
- std::regex_replace(nuspec_file_content, std::regex("@TARGETS_REDIRECT_PATH@"), targets_redirect_path);
+ Strings::replace_all(std::move(nuspec_file_content), "@TARGETS_REDIRECT_PATH@", targets_redirect_path);
return nuspec_file_content;
}

Use Strings::replace_all() instead of std::regex_replace()