asp.net - Validate textbox with RegularExpressionValidator -


i have text box want validate format of text: p-xxxxxxxx-xxxxx-xx. need "xxxxxxxx" stricted 8 digit, "xxxxx" 1 5 digit , "xx" 1 or 2 digit. how can regular expression validator textbox in asp.net :

<asp:textbox id="cadastralnumbertextbox" autopostback="true" runat="server" meta:resourcekey="cadastralnumbertextboxresource1"                                              text='<%# bind("cadastralnumber") %>' width="98%" readonly="false"></asp:textbox>

the regular expression validate p-xxxxxxxx-xxxxx(1 or 5 digits)-xx(1 or 2 digits) use ([p]-\d{8}-(\d{1}|\d{5})-(\d{1,2})) regular expression.

to validate p-xxxxxxxx-xxxxx(1 to 5 digits)-xx(1 or 2 digits), use ([p]-\d{8}-(\d{1,5})-(\d{1,2})) validator

the first 1 requires second grouping of numbers 1 or 5 digits long, whereas second 1 requires second grouping of numbers 1, 2, 3, 4, or 5 digits longs.

i hope answers question.

edit: http://www.regexr.com/ useful site kind of issue. has helpful information on syntax , live match regex, can test it.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -