我有一个问题orderedDictionary
和Regex
。如何通过文本定义问题,但我会尝试解释......
这是我的代码:
var smilies = new OrderedDictionary
{
{@":(", "smile_sadx24"},
{@">:(", "smile_angryx24"},
};
foreach (string smiley in smilies.Keys)
{
var re = new Regex(@"(?<!(=""))" + Regex.Escape(smiley) + @"(?<!(""))");
if (re.IsMatch(incomingtext))
{
string m2 = re.Replace(incomingtext, "<img src=\"/Content/themes/mavi/img/custom/smiles/" + smilies[smiley] + ".png\" alt=\"" + smiley + "\"/>");
incomingtext = m2;
}
}
当我试图处理>:(
然后它返回smile_sadx24
不smile_angryx24
...
因为它:(
先捕获...
我怎么解决这个问题?