asp.net - Limit the number of rows in a multiline textbox -
asp.net - Limit the number of rows in a multiline textbox -
is there way limit number of rows in multiline textbox? want allow user input 12 lines of text in multiline textbox. right textbox accepts many lines user throws @ it.
another hurdle fact multiline textbox within of listview making hard retrieve textbox name using javascript.
can utilize regular look validator limit number of new lines 12? if so, proper regex? i've tried ^(\n|\r|\r\n){0,12}$
doesn't work @ all.
you should able utilize regex validator this. seek expression:
^[^\n]*(?:\n[^\n]*){0,11}$
if want limit lines maximum of 65 character each, can use:
^[^\n]{0,65}(?:\n[^\n]{0,65}){0,11}$
if want count lines if there soft line breaks lines longer 65 characters, work:
^[^\n]{0,65}(?:\n?[^\n]{0,65}){0,11}$
note ?
after \n
, making line break character self optional.
you may want optimize look minimize backtracking adding atomic groups, example:
^(?>[^\n]{0,65})(?>(?>\n?[^\n]{0,65}){0,11})$
asp.net .net regex textbox multiline
Comments
Post a Comment