【www.gdgbn.com--正则表达式】

c# 验证中文 数字 整数的正则表达式

整数

regex.ismatch(inputerstr, "^([0-9]{1,})$")

数字

regex.ismatch(inputerstr, "^([0-9]{1,}[.][0-9]*)$")

英文字母

bool bb = regex.ismatch("/sdfsdf/", @"^/[a-z]*/$");


看一款支持中文正则

string[] sentences =
  {
   "你",
   "x"
   };
 bool find = false;
 string spattern = this.content.text;
 foreach (string s in sentences)
    {
    if (system.text.regularexpressions.regex.ismatch(spattern,s))
    {
    //找到了
    }
    else
    {
    //没有找到
    }

本文来源:http://www.gdgbn.com/aspjiaocheng/28435/