FindAdv: Amend 93b6fe2c, forgot about uppercase greek symbols

This commit is contained in:
Kornel Benko 2022-03-27 13:43:42 +02:00
parent 7d053393a5
commit f78ddc49ad

View File

@ -838,7 +838,7 @@ string correctRegex(string t, bool withformat)
* and \{, \}, \[, \] => {, }, [, ] * and \{, \}, \[, \] => {, }, [, ]
*/ */
string s(""); string s("");
regex wordre("(\\\\)*(\\\\(([a-z]+) ?|[\\[\\]\\{\\}]))"); regex wordre("(\\\\)*(\\\\(([A-Za-z]+)( |\\{\\})?|[\\[\\]\\{\\}]))");
size_t lastpos = 0; size_t lastpos = 0;
smatch sub; smatch sub;
bool backslashed = false; bool backslashed = false;
@ -880,7 +880,7 @@ string correctRegex(string t, bool withformat)
else { else {
AccentsIterator it_ac = accents.find(sub.str(4)); AccentsIterator it_ac = accents.find(sub.str(4));
if (it_ac == accents.end()) { if (it_ac == accents.end()) {
replace = sub.str(3); replace = sub.str(2);
} }
else { else {
replace = it_ac->second; replace = it_ac->second;
@ -1092,7 +1092,7 @@ static docstring buffer_to_latex(Buffer & buffer)
static string latexNamesToUtf8(docstring strIn) static string latexNamesToUtf8(docstring strIn)
{ {
string addtmp = to_utf8(strIn); string addtmp = to_utf8(strIn);
static regex const rmAcc("(\\\\)*(\\\\([a-z]+) ?)"); static regex const rmAcc("(\\\\)*(\\\\([A-Za-z]+)( |\\{\\})?)");
size_t lastpos = 0; size_t lastpos = 0;
smatch sub; smatch sub;
string replace; string replace;
@ -1943,9 +1943,15 @@ void Intervall::removeAccents()
{ {
if (accents.empty()) if (accents.empty())
buildAccentsMap(); buildAccentsMap();
static regex const accre("\\\\(([\\S]|grave|breve|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde|subdot|ogonek|" static regex const accre("\\\\("
"cedilla|subring|textsubring|subhat|textsubcircum|subtilde|textsubtilde|dgrave|textdoublegrave|rcap|textroundcap|slashed)\\{[^\\{\\}]+\\}" "([\\S]|[a-z]+)\\{[^\\{\\}]+\\}"
"|((i|imath|jmath|cdot|[a-z]+(space)?)|((backslash )?([lL]y[xX]|[tT]e[xX]|[lL]a[tT]e[xX]e?|lyxarrow))|(textquote|brace|guillemot)(left|right)|textasciicircum|mathcircumflex|sim)(?![a-zA-Z]))"); "|("
"(i|imath|jmath|cdot|[a-z]+(space)?)"
"|((backslash )?([lL]y[xX]|[tT]e[xX]|[lL]a[tT]e[xX]e?|lyxarrow))"
"|(textquote|brace|guillemot)(left|right)"
"|textasciicircum|mathcircumflex|sim|[A-Za-z]+"
")"
"(?![a-zA-Z]))");
smatch sub; smatch sub;
for (sregex_iterator itacc(par.begin(), par.end(), accre), end; itacc != end; ++itacc) { for (sregex_iterator itacc(par.begin(), par.end(), accre), end; itacc != end; ++itacc) {
sub = *itacc; sub = *itacc;