如题,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);
}
只能提取汉字,标点符号没有了
解决方案 »
- 如何取得当前行的行号,急!
- 请教Cache对象的自动销毁时间设定
- sql server连接出错问题
- asp.net cookie问题。
- 100分求:System.ArgumentException: Column 'xxx' does not belong to table Table.
- asp.net怎样根据EXCEL的xlt格式的文件编程??
- 关于树形目录的链接问题,高手进......
- 请问如何通过vb把数据导出到excel里?
- 谁有cnblog的源码啊 ,大侠帮我啊
- 急:怎么动态改变datagrid的自定义模板列的属性啊?
- treeview设置navigateurl后的相关问题
- ASP问题,请高手帮忙解决。谢谢!!急!!!
string pattern = @"^[\u300a\u300b]|[\u4e00-\u9fa5]|[\uFF00-\uFFEF]|[,。!]";
[?,.;'\[\]{}~!@#$%^&*()_+|\-\\~!@#¥%……&*()——+|、]
str=System.Text.RegularExpressions.Regex.Replace(str,@"[^(\u4e00-\u9fa5)]","");