[PowerRename] capturing groups fix (#4181)

* Fix capturing group bug when Match All Occurrences is not checked

* Capture groups are now available when Match All Occurences option is not selected

* Bug fix when capture group is indicated with leading zeros. $01 should be considered as $1 etc

* Use flags in regex_replace() when Match All Occurences is not selected

Now the behaviour is consistent with how regex works when Match All Occurences is selected.
This commit is contained in:
Mehmet Murat Akburak 2020-06-16 11:04:14 +03:00 committed by GitHub
parent 49cbcf01c6
commit 014f3b9873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,11 +210,7 @@ HRESULT CPowerRenameRegEx::Replace(_In_ PCWSTR source, _Outptr_ PWSTR* result)
}
else
{
std::wsmatch m;
if (std::regex_search(sourceToUse, m, pattern))
{
res = sourceToUse.replace(m.prefix().length(), m.length(), replaceTerm);
}
res = regex_replace(wstring(source), pattern, replaceTerm, regex_constants::format_first_only);
}
}
else