validation controls

Posted by kishore_guruju-3194 under Regular Expressions on 2/17/2010 | Views : 2087 | Status : [Member] | Replies : 10
hi,
i use a regular expression validator control and i want to make my own validationexpression its start with digit 5 and contains max 6 digits length, how to get this?




Responses

Posted by: Bubbly on: 2/17/2010 [Member] Bronze

Up
0
Down
Hello,

Try this

^\5d{1,6}


++
Thanks & Regards,
Deepika

kishore_guruju-3194, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 2/17/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
I think this would be
5\d{5}


:)

www.abhisheksur.com

kishore_guruju-3194, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/18/2010 [Member] Bronze

Up
0
Down
Check the following link
http://www.java2s.com/Code/ASP/Validation-by-Control/Regularexpressionvalidatord5d5d4VBnet.htm

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

kishore_guruju-3194, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 2/18/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Well, a simple addition, if you want less than 6 digits for your regexp, you need to adjust your regular expression a bit.

it will be

5?\d{0,5}


I am sorry, I overlooked that you mentioned a maximum 5 digits.
Cheers


www.abhisheksur.com

kishore_guruju-3194, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 6/29/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Hi,

Try this...
it will help u...

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"  ErrorMessage="Enter valid Code" ValidationExpression="^5[0-9]{5}$" SetFocusOnError="True"  ></asp:RegularExpressionValidator>


ValidationExpression="^5[0-9]{5}$"


kishore_guruju-3194, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CGN007 on: 6/29/2012 [Member] Silver | Points: 25

Up
0
Down
http://regexlib.com/

kishore_guruju-3194, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CGN007 on: 6/29/2012 [Member] Silver | Points: 25
Posted by: CGN007 on: 6/29/2012 [Member] Silver | Points: 25
Posted by: Muralidosscm on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
Maxlength="5" just write in the textbox control.

It doesn't allow more than 5dogits to enter the values in the textbox

Regards
Muralidoss M

kishore_guruju-3194, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 7/4/2012 [Member] Starter | Points: 25

Up
0
Down
ValidationExpression="^5[0-9]{5}$" and also set Maxlength="5"

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

kishore_guruju-3194, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response