日期:2014-05-17  浏览次数:20827 次

C# 后台如何写正则表达式
我想判断 textbox中输入的字符是否为 “15位数字”
或者是否为“字符串”
在后台写正则表达式 需要引用什么么 请详细解答

------解决方案--------------------
using System.Text.RegularExpressions;
------解决方案--------------------
string pattern ="result=\"([^\"]*)\"";        
            Regex regex = new Regex(pattern);
            Match match = regex.Match(url);
            if (match.Success)
            {  
             Console.Write("true");
            }
            else
            {
                Console.Write("false");
            }

         
------解决方案--------------------
引用:
Quote: 引用:

string pattern ="result=\"([^\"]*)\"";        
            Regex regex = new Regex(pattern);
            Match match = regex.Match(url);
            if (match.Success)
            {  
             Console.Write("true");
            }
            else
            {