本文介绍了如何验证与普通防爆pression验证一个文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我测试了我的正常前pression在rubular,它是通过我的所有需要​​conditions.But当我使用到ASP文本框它不是真正的传递

I have tested my regular expression in "rubular" and it is passing all my required conditions.But when i use that into asp text box its not passing true.

我的code看起来像下面

My Code looks like below

<asp:TextBox ID="MobileNumber" runat="server"></asp:TextBox>
    <asp:RegularExpressionValidator ID="MobileNumberValidater" runat="server" ControlToValidate="MobileNumber" ErrorMessage="Please enter valid Numbers"></asp:RegularExpressionValidator>

我经常EX pression看起来像下面

My regular expression looks like below

^((0((= \\ D * \\ D *#)[\\ D] {11})(#\\ D {5}))|(0(?:?\\ d {10 })(#\\ D {5}))|?(0((= \\ D * \\ D * $)[\\ D] {11})))$

^((0((?=\d* \d*#)[\d ]{,11})(#\d{,5})?)|(0(?:\d{,10})(#\d{,5})?)|(0((?=\d* \d*$)[\d ]{,11})))$

我想验证以下字符串:

1)0.012345 6789#123

1).012345 6789#123

2)0.025698 785#6548

2).025698 785#6548

感谢。

推荐答案

一个快速检查的似乎表明,你正在使用正则表达式的格式不正确的.Net客户端。我不熟悉Rubular,但它可能是,它采用了不同的正则表达式引擎。

A quick check here seems to indicate that the regex you are using is incorrectly formatted for the .Net client. I'm not familiar with Rubular, but it may be that it uses a different regex engine.

我与您正则表达式一出戏,但这些电话号码不看像什么我见过,所以如果你坚持它可能是值得考虑看看的。

I had a play with your regex, but those phone numbers don't look like anything I've seen, so if you're stuck it may be worth taking a look here.

这篇关于如何验证与普通防爆pression验证一个文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 10:55