FindAdv: Convert '\%' in a regex to '%'

Regex contents comes from handling hullRegexp, so we
have to reverse some its handling, among others also for the char '%'
This commit is contained in:
Kornel Benko 2022-04-16 15:10:33 +02:00
parent 965b2cdc73
commit 28b206665f

View File

@ -838,7 +838,7 @@ string correctRegex(string t, bool withformat)
* and \{, \}, \[, \] => {, }, [, ]
*/
string s("");
regex wordre("(\\\\)*(\\\\(([A-Za-z]+|[\\{\\}])( |\\{\\})?|[\\[\\]\\{\\}]))");
regex wordre("(\\\\)*(\\\\(([A-Za-z]+|[\\{\\}%])( |\\{\\})?|[\\[\\]\\{\\}]))");
size_t lastpos = 0;
smatch sub;
bool backslashed = false;
@ -893,6 +893,8 @@ string correctRegex(string t, bool withformat)
replace = "{";
else if (sub.str(4) == "}")
replace = "}";
else if (sub.str(4) == "%")
replace = "%";
else {
AccentsIterator it_ac = accents.find(sub.str(4));
if (it_ac == accents.end()) {