开发者

Regular Expression Validation - Range Validation with minium length value and undefinited maximum length

I use ASP.NET and C#.

I have a RegularExpressionValidator control on a Web Form Page, and I use a custom regex to check the minim an maximum length for an input TextBox.

I need to modify the regex to check just a minimum value but set as UNLIMITED the m开发者_运维问答aximum value. So validation for a TextBox would be only for the minimum length.

Any ideas how to change by regex?

Here my code. Thanks for your help!

<asp:RegularExpressionValidator ID="uxRegularExpressionValidatorHighlightMaxLengthDisplayer"
                        runat="server" ControlToValidate="uxSummaryInputer" ErrorMessage="Highlight is too long or short. Change the field accordingly."
                        ValidationExpression="^.{64,256}$">*</asp:RegularExpressionValidator>


Just change it to be:

 ValidationExpression="^.{64,}$"


You can use range validator instead og regular expression validator, in the range validator you can specify range with type="string" method. like this....

<asp:RangeValidator ID="range" runat="server" ControlToValidate="txt" MinimumValue="0" MaximumValue="65123" Type="String" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜