Regular Expression Validator - odd case?
Hi,
I'm using the regular expression validator (p. 306) to guard against a text box entry that is too long. The regular expression I'm using is "^.{1,20}$". This works quite well normally. However if I enter more than 20 characters in a text box AND the text in the textbox contains one or more carriage return characters (\n) the following occurs:
1. I obtain the expected notice that the expression is too long.
2. I shorten the expression to 20 or less characters and the validator continues to show that the expression is too long until I have erased all of the carriage return characters.
I have found jQuery expressions that can replace the carriage return characters with " " but I need to retain them and would like the length test to work even with the carriage return characters present. Is that possible?
|