Fix compile error with USE_STD_REGEX

Issue [#74](https://github.com/tindy2013/subconverter/issues/74).
This commit is contained in:
Tindy X authored and GitHub committed 2020-02-26 22:51:36 -06:00
1 parent 0eaec3a162
commit 8fe8dcbe86
1 file changed
+9 -6
+9 -6
View File
@@ -521,12 +521,13 @@ bool regValid(const std::string &reg)
}
}
bool regFind(const std::string &src, const std::string &target)
bool regFind(const std::string &src, const std::string &match)
{
try
{
std::regex::flag_type flags = std::regex::extended | std::regex::ECMAScript;
if(target.find("(?i)") == 0)
std::string target = match;
if(match.find("(?i)") == 0)
{
target.erase(0, 4);
flags |= std::regex::icase;
@@ -546,12 +547,13 @@ std::string regReplace(const std::string &src, const std::string &match, const s
try
{
std::regex::flag_type flags = std::regex::extended | std::regex::ECMAScript;
std::string target = match;
if(match.find("(?i)") == 0)
{
match.erase(0, 4);
target.erase(0, 4);
flags |= std::regex::icase;
}
std::regex reg(match, flags);
std::regex reg(target, flags);
regex_replace(back_inserter(result), src.begin(), src.end(), reg, rep);
}
catch (std::regex_error &e)
@@ -566,12 +568,13 @@ bool regMatch(const std::string &src, const std::string &match)
try
{
std::regex::flag_type flags = std::regex::extended | std::regex::ECMAScript;
std::string target = match;
if(match.find("(?i)") == 0)
{
match.erase(0, 4);
target.erase(0, 4);
flags |= std::regex::icase;
}
std::regex reg(match, flags);
std::regex reg(target, flags);
return regex_match(src, reg);
}
catch (std::regex_error &e)