1#ifndef ALGOPLUS_REGEX_PATTERNS_H
2#define ALGOPLUS_REGEX_PATTERNS_H
24void find_and_replace_regex(std::string& target,
const std::string pattern,
25 const std::string newstr) {
26 std::regex regex_pattern(pattern);
27 target = std::regex_replace(target, regex_pattern, newstr);
44void find_and_replace(std::string& str,
const std::string pattern,
const std::string newstr) {
45 std::string::size_type pos = 0u;
46 while ((pos = str.find(pattern, pos)) != std::string::npos) {
47 str.replace(pos, pattern.length(), newstr);
48 pos += newstr.length();