如题,string pattern = @"^[\u300a\u300b]|[\u4e00-\u9fa5]|[\uFF00-\uFFEF]";
string str = "dfa#445发了,. 。*(*&*^e4444";
if (System.Text.RegularExpressions.Regex.IsMatch(str, pattern))
{
//提示的代码在这里写
System.Text.RegularExpressions.Match m =
System.Text.RegularExpressions.Regex.Match(str, pattern);
string v = "";
while (m.Success)
{
if (m.Value == ",")
{
v += m.Value;
continue;
}
v += m.Value;
m = m.NextMatch();
}
Response.Write(v);
}
只能提取汉字,标点符号没有了
string str = "dfa#445发了,. 。*(*&*^e4444";
if (System.Text.RegularExpressions.Regex.IsMatch(str, pattern))
{
//提示的代码在这里写
System.Text.RegularExpressions.Match m =
System.Text.RegularExpressions.Regex.Match(str, pattern);
string v = "";
while (m.Success)
{
if (m.Value == ",")
{
v += m.Value;
continue;
}
v += m.Value;
m = m.NextMatch();
}
Response.Write(v);
}
只能提取汉字,标点符号没有了
解决方案 »
- ASP.NET from 问题;
- 关于如果做MD5加密的问题,新手!谢谢!
- 如何做跨域提交
- 承接.net项目,各方面都可。
- 给分100.急急!!!各位大虾帮帮忙.
- 在线急呀。。。。。。。关于DataGrid动态排序的问题。。。。请各位高手帮忙!
- 在*.vb类文件中调取session或cookie值的问题
- Atlas是不是只能以web service提供异步信息啊?有人有好的例子吗?感觉微软的框架不够自动,那么多手动工作
- www.yoouhe.com改版,非常感谢大家的意见,散分2.
- asp.net如何实现像百度文档那种在线查看文档的功能
- treeview设置navigateurl后的相关问题
- ASP问题,请高手帮忙解决。谢谢!!急!!!
string pattern = @"^[\u300a\u300b]|[\u4e00-\u9fa5]|[\uFF00-\uFFEF]|[,。!]";
[?,.;'\[\]{}~!@#$%^&*()_+|\-\\~!@#¥%……&*()——+|、]
str=System.Text.RegularExpressions.Regex.Replace(str,@"[^(\u4e00-\u9fa5)]","");