don’t do replace words if there is a dash before or after the word

This commit is contained in:
John Jenko 2013-10-11 13:14:31 +00:00
parent f5cf55a022
commit 2deb6dc799

View File

@ -1545,7 +1545,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\?)" + replaceWord + @"(?!\\u160\?)" + wordMatchEnd;
string pat = wordMatchBeg + @"(?<!\\u160\?|\\u8209\?)" + replaceWord + @"(?!\\u160\?|\\u8209\?)" + wordMatchEnd;
dicReplaceRegex.Add(rs, new Regex(pat, myOptions));
}
try