Regular Expression for multiline validation

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

To validate the length of a multiline textbox, I'm told that I have to use a
regular expression validator. The regular expression below limits it to 25
characters in length, but if the user enters a hard return, it bombs
regardless of length. How do you allow hard returns in the following
regular expression? Thanks in advance!

^.{0,25}$

Mark
 
Mark,

Sorry, I took that expression from another forum's post. I had never
actually tested it myself. My bad. I just played around a bit. Try this
instead: ^[\s\S]{0,10}$

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
Use a regular expression validator with the expression "(.|\r|\n){0,255}"
replacing the 0 and 255 with the minimum and maximum lengths that you need.
 
Back
Top