mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 01:08:18 +08:00
[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:
parent
49cbcf01c6
commit
014f3b9873
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user