There goes my regex crown

This commit is contained in:
RogueException
2015-09-16 18:29:53 -03:00
parent 679eebd2bc
commit 0211930915

View File

@@ -11,7 +11,7 @@ namespace Discord
static Format()
{
const string innerPattern = "[_*]|~~";
_escapeRegex = new Regex($@"(?:^|\W)(?:{innerPattern})|(?:{innerPattern})(?:\W|$)|\\", RegexOptions.Compiled);
_escapeRegex = new Regex($@"(?<=^|\W)(?:{innerPattern})|(?:{innerPattern})(?=\W|$)|\\", RegexOptions.Compiled);
_escapeEvaluator = new MatchEvaluator(e => '\\' + e.Value);
}