读书人

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

发布时间: 2013-08-13 16:43:28 作者: rapoo

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可以判断是否为数字

读书人网 >C#

热点推荐