首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C# 后台怎么写正则表达式

2013-08-13 
C# 后台如何写正则表达式我想判断 textbox中输入的字符是否为 “15位数字”或者是否为“字符串”在后台写正则

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
            {


                Console.Write("false");
            }


         


你写的这些 前半部分能讲解一下么


代码都给了 为什么不去MSDN看看呢 ?
http://msdn.microsoft.com/zh-cn/library/vstudio/system.text.regularexpressions.regex.match.aspx
[解决办法]
char.IsNumber可以判断是否为数字

热点排行