Showing posts with label regex. Show all posts
Showing posts with label regex. Show all posts

Sunday, October 17, 2010

Multiline Textbox Character Limit

Giving character limit to a multiline textbox can be done using a regular expression validator. Add a regular expression validator to theaspx page and set the control to validate as the multiline text box. Then in the validation expression give

^[\s\S]{0,2000}$
This solution limits the character length to 2000 characters including blank spaces and tabs.

Cheers