常用正则表达式

1、判断在字符在字符串,有没有值。

    public bool isExists(string str)
    {
        if (str != "")
        {
            return Regex.Match(str, "[a-eA-E]").Success;
        }
        else
        {
            return true;
        }

    }

  

 2、判读是否全是数字:

Regex.IsMatch(TextBox5.Text.ToString().Trim(),@"^\d+$")

 

posted on 2015-05-09 09:58  雪夜  阅读(136)  评论(0编辑  收藏  举报