Fixed B2015-072, replace words crashing on ‘ [‘ where space is part of bold rtf command.

Allow for a step transition to go to another procedure
This commit is contained in:
Kathy Ruffing 2015-05-28 13:16:43 +00:00
parent e8eed87c3b
commit 804da7a3ca
2 changed files with 2 additions and 2 deletions

Binary file not shown.

View File

@ -1817,7 +1817,7 @@ namespace Volian.Controls.Library
// don't use the \W, i.e. don't bother to look for a non-word character.
string wordMatchBeg = Regex.IsMatch(replaceWord.Substring(0, 1), @"\W") ? "" : @"(?<=\W|^)";
string wordMatchEnd = Regex.IsMatch(replaceWord.Substring(replaceWord.Length - 1, 1), @"\W") ? "" : @"(?=\W|$)";
string pat = wordMatchBeg + @"(?<!\\u160\?|\\u8209\?)" + replaceWord + @"(?!\\u160\?|\\u8209\?)" + wordMatchEnd;
string pat = wordMatchBeg + @"(?<!\\u160\?|\\u8209\?|\\b)" + replaceWord + @"(?!\\u160\?|\\u8209\?)" + wordMatchEnd;
dicReplaceRegex.Add(rs, new Regex(pat, myOptions));
//ProfileTimer.Pop(profileDepth3);
}
@ -2101,7 +2101,7 @@ namespace Volian.Controls.Library
}
string preceedingText = text.Substring(0, offset + foundMatch.MyMatch.Index);
int ndxBold = preceedingText.LastIndexOf(@"\b");
if (ndxBold > -1 && preceedingText[ndxBold + 2] != '0' && with.Contains(@"\b "))
if (ndxBold > -1 && preceedingText.Length>(ndxBold+2) && preceedingText[ndxBold + 2] != '0' && with.Contains(@"\b "))
{
with = with.Replace(@"\b ","");
with = with.Replace(@"\b0 ","");