C2021-061 don’t process replace words if they are delimited with “()” or “,’ (quotes from 11/3/21)

This commit is contained in:
2021-11-16 13:50:28 +00:00
parent d8983d41d6
commit b92bdb3466
4 changed files with 14 additions and 5 deletions

View File

@@ -2123,8 +2123,8 @@ namespace VEPROMS.CSLA.Library
string wordMatchEnd = Regex.IsMatch(replaceWord.Substring(replaceWord.Length - 1, 1), @"\W") ? "" : @"(?=\W|$)";
string pat = wordMatchBeg + @"(?<!\\u160\?|\\u8209\?|\\b|\-)" + replaceWord + @"(?!\\u160\?|\\u8209\?|\-)" + wordMatchEnd;
// C2021-061: For Barakah don't do replace if word is surrounded by " or ', i.e. they are no longer delimiters
if (_MyItemInfo != null && _MyItemInfo.ActiveFormat != null && _MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.NoReplaceQuoteWords)
pat = wordMatchBeg + @"(?<!\\u160\?|\\u8209\?|\\b|\-|""|')" + replaceWord + @"(?!\\u160\?|\\u8209\?|\-|""|')" + wordMatchEnd;
if (_MyItemInfo != null && _MyItemInfo.ActiveFormat != null && _MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.NoReplaceQuoteParenWords)
pat = wordMatchBeg + @"(?<!\\u160\?|\\u8209\?|\\b|\-|""|'|\()" + replaceWord + @"(?!\\u160\?|\\u8209\?|\-|""|'|\))" + wordMatchEnd;
dicReplaceRegex.Add(rs, new Regex(pat, myOptions));
//ProfileTimer.Pop(profileDepth3);
}