|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2009-11-25 20:26:27
|
显示全部楼层
谢谢大家.
因为中间英文可能变,所以我用了以下方式:
Regex ruleRegex = new Regex(@"[a-z]{4,8}\d[a-z]{4,8}\d[a-z]{4,8}\d[a-z]{4,8}\d[a-z]{4,8}\d[a-z]{4,8}\d[a-z]{4,8}\d[a-z]{4,8}\d[a-z]{4,8}\d");
string historyText = ruleRegex.Matches(removeOtherChar(historyText))[ruleRegex.Matches(removeOtherChar(historyText)).Count - 1].ToString() ;
private string removeOtherChar(string old)
{
string newStr = null;
foreach (char item in old)
{
if ((item > 64 && item < 91) || (item > 96 && item < 123) || (item > 48 && item < 58))
{
newStr += item;
}
}
return newStr;
} |
|