我下面这段判断只判断了13、14、15、18开头可以,但像145啦,184啦,154啦都有,我想只要判断手机号码的,怎样改,小女子先在这里谢谢了(*^__^*)  if IsNumeric(request("call")) and len(request("call"))=11 and left(request("call"),1)="1" and (mid(request("call"),2,1)= "3" or mid(request("call"),2,1)= "5" or mid(request("call"),2,1)= "8" or mid(request("call"),2,1)= "4") then

解决方案 »

  1.   

    asp正则表达式在哪里用,可以贴出代码吗
      

  2.   

    http://www.west263.com/info/html/wangluobiancheng/Aspbiancheng/20080226/48588_2.html
      

  3.   

     //验证手机
       function checkShouJi(){
    var shouji=document.getElementById("ShouJi").value;
    if(shouji==""){ }
           else if(isNaN(shouji)){}
                   else if(shouji.length!=11){}
           else{ }
     }用正则更好
      

  4.   

    ^(\d{3})?13[0-9]\d{8}|15[0123589]\d{8}|18[79]\d{8}<asp:TextBox ID="TextBoxPhone" runat="server" Width="150px"></asp:TextBox>&nbsp;&nbsp;<asp:RegularExpressionValidator
                                    ID="RegularExpressionValidator1" runat="server" ErrorMessage="请输入正确的手机号码" ControlToValidate="TextBoxPhone"
                                    ValidationExpression="^(\d{3})?13[0-9]\d{8}|15[0123589]\d{8}|18[79]\d{8}"></asp:RegularExpressionValidator>
      

  5.   

    function checkMobile(){ 
    var sMobile = document.mobileform.mobile.value 
    if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(sMobile))){ 
    alert("不是完整的11位手机号或者正确的手机号前七位"); 
    document.mobileform.mobile.focus(); 
    return false; 
      

  6.   

    /// <summary>  02 /// 显示Match内多个Group的例子  03 /// </summary>  04 public void ShowStructure()  05 {  06     //要匹配的字符串  07     string text = "1A 2B 3C 4D 5E 6F 7G 8H 9I 10J 11Q 12J 13K 14L 15M 16N ffee80 #800080";  08     //正则表达式  09     string pattern = @"((\d+)([a-z]))\s+";  10     //使用RegexOptions.IgnoreCase枚举值表示不区分大小写  11     Regex r = new Regex(pattern, RegexOptions.IgnoreCase);  12     //使用正则表达式匹配字符串,仅返回一次匹配结果  13     Match m = r.Match(text);  14     while (m.Success)  15     {  16         //显示匹配开始处的索引值和匹配到的值  17         System.Console.WriteLine("Match=[" + m + "]");  18         CaptureCollection cc = m.Captures;  19         foreach (Capture c in cc)  20         {  21             Console.WriteLine("\tCapture=[" + c + "]");  22         }  23         for (int i = 0; i < m.Groups.Count; i++)  24         {  25             Group group = m.Groups[i];  26             System.Console.WriteLine("\t\tGroups[{0}]=[{1}]", i, group);  27             for (int j = 0; j < group.Captures.Count; j++)  28             {  29                 Capture capture = group.Captures[j];  30                 Console.WriteLine("\t\t\tCaptures[{0}]=[{1}]", j, capture);  31             }  32         }  33         //进行下一次匹配.  34         m = m.NextMatch();  35     }  36 } 
    [代码] 执行效果
    view sourceprint?
    01 Match=[1A ]  02     Capture=[1A ]  03         Groups[0]=[1A ]  04             Captures[0]=[1A ]  05         Groups[1]=[1A]  06             Captures[0]=[1A]  07         Groups[2]=[1]  08             Captures[0]=[1]  09         Groups[3]=[A]  10             Captures[0]=[A]  11 Match=[2B ]  12     Capture=[2B ]  13         Groups[0]=[2B ]  14             Captures[0]=[2B ]  15         Groups[1]=[2B]  16             Captures[0]=[2B]  17         Groups[2]=[2]  18             Captures[0]=[2]  19         Groups[3]=[B]  20             Captures[0]=[B]  21 ..................此去省略一些结果  22 Match=[16N ]  23     Capture=[16N ]  24         Groups[0]=[16N ]  25             Captures[0]=[16N ]  26         Groups[1]=[16N]  27             Captures[0]=[16N]  28         Groups[2]=[16]  29             Captures[0]=[16]  30         Groups[3]=[N]  31             Captures[0]=[N] 
    [代码] 另外一种写法
    view sourceprint?
    01 /// <summary>  02 /// 使用Regex类的Matches方法所有所有的匹配  03 /// </summary>  04 public void Matches()  05 {  06     //要匹配的字符串  07     string text = "1A 2B 3C 4D 5E 6F 7G 8H 9I 10J 11Q 12J 13K 14L 15M 16N ffee80 #800080";  08     //正则表达式  09     string pattern = @"((\d+)([a-z]))\s+";  10     //使用RegexOptions.IgnoreCase枚举值表示不区分大小写  11     Regex r = new Regex(pattern, RegexOptions.IgnoreCase);  12     //使用正则表达式匹配字符串,返回所有的匹配结果  13     MatchCollection matchCollection = r.Matches(text);  14     foreach (Match m in matchCollection)  15     {  16         //显示匹配开始处的索引值和匹配到的值  17         System.Console.WriteLine("Match=[" + m + "]");  18         CaptureCollection cc = m.Captures;  19         foreach (Capture c in cc)  20         {  21             Console.WriteLine("\tCapture=[" + c + "]");  22         }  23         for (int i = 0; i < m.Groups.Count; i++)  24         {  25             Group group = m.Groups[i];  26             System.Console.WriteLine("\t\tGroups[{0}]=[{1}]", i, group);  27             for (int j = 0; j < group.Captures.Count; j++)  28             {  29                 Capture capture = group.Captures[j];  30                 Console.WriteLine("\t\t\tCaptures[{0}]=[{1}]", j, capture);  31             }  32         }  33     }  34 } 
    [代码] 输出结果
    view sourceprint?01 Match=[5M ]  02         Capture=[5M ]  03                 Groups[0]=[5M ]  04                         Captures[0]=[5M ]  05                 Groups[1]=[5M]  06                         Captures[0]=[5M]  07                 Groups[2]=[5]  08                         Captures[0]=[5]  09                 Groups[3]=[M]  10                         Captures[0]=[M]  11 Match=[16N ]  12         Capture=[16N ]  13                 Groups[0]=[16N ]  14                         Captures[0]=[16N ]  15                 Groups[1]=[16N]  16                         Captures[0]=[16N]  17                 Groups[2]=[16]  18                         Captures[0]=[16]  19                 Groups[3]=[N]  20                         Captures[0]=[N] 
      

  7.   

    <asp:TextBox ID="txtMobile" runat="server" size="25" Width="200px"></asp:TextBox>                            <asp:RegularExpressionValidator ID="revMobile" runat="server" Display="Dynamic" ErrorMessage="手机格式不正确"
                                    ValidationExpression="^1((4[47])|(5[0-35-9])|(8[256789])|(3\d))\d{8}$" ControlToValidate="txtMobile"></asp:RegularExpressionValidator>(其中号段有:
    中国移动G网 134 135 136 137  138 139 144 147 150 151 152 157 158 159 187 188 
    中国联通G网 130 131 132 155  156 185 186 
    中国电信C网 133 153 180 189 

    这是我收集到的有关的手机号体段总结出来的验证表达式