现在的位置: 首页 > 综合 > 正文

ASP.NET正则表达式的初用

2017年12月01日 ⁄ 综合 ⁄ 共 296字 ⁄ 字号 评论关闭

 

using System.Text.RegularExpressions;

  private void btCheckName_Click(object sender, System.EventArgs e)
  {
   string UserName = this.UserName.Text.Replace("'","''").ToString();
    if(UserName!="")
   { 

 

      Regex regExp = new Regex("^[0-9A-Za-z]{3,16}$");

    if(regExp.IsMatch(UserName))
    {

     .......

  }

}

 

}

抱歉!评论已关闭.