1
大家好:我需要使用RexEx匹配相似的单词。例如,如果我有一个包含“自主”这样的词的模式,它应该匹配单词“自主”而不匹配“自主”。
示例代码:
使用RegEx匹配相似单词
void modify(string word)
{
string input = "This island is a colony; however,it is autonomous and " +
"receives no orders from the mother country, autonomy, N.";
string pattern = @",\s" + word + @"\s[v|n|adj]\.";//word = "autonomous";
Regex reg = new Regex(pattern);
string output = reg.Replace(input, ".");
}
对不起。我向女士道歉。 – FadelMS 2012-08-12 05:13:46
你确定你的代码与自治系统匹配吗? – 2012-08-12 05:22:52
@habib:那是我不想要的。 – FadelMS 2012-08-12 05:28:46