读书人

正则过滤非中文有关问题

发布时间: 2012-03-08 13:30:13 作者: rapoo

正则过滤非中文问题

C# code
        string TempForm = Server.UrlDecode(Request.w.co

我这样写 无法正常过滤非中文字符 也就是说没有办法取出完全由中文组成的文字!

[解决办法]
[\u4e00-\u9fa5]这个都过滤不了?
帮顶
[解决办法]
string TempForm = Server.UrlDecode(Request.Form.ToString());
string tf="";

Regex regex = new Regex("([\u4e00-\u9fa5]+)");
for(Match match=regex.Match(TempForm ,0);match.Success;match=match.NexeMatch())
{
tf+=match.Groups[1].ToString();
}
[解决办法]
探讨
string TempForm = Server.UrlDecode(Request.Form.ToString());
string tf="";

Regex regex = new Regex("([\u4e00-\u9fa5]+)");
for(Match match=regex.Match(TempForm ,0);match.Success;match=match.NexeMatch())
{
tf+=match.Groups[1].ToString();
}

读书人网 >asp.net

热点推荐