For the ASP.NET project that I'm currently working on, I wanted to limit the number of characters that could be entered into a specific textbox control to a maximum of 25 characters (NOTE: since this was a required field so I also wanted them to at least enter 1 character); however, in this particular instance, I wanted to allow the user to be able to enter any kind of special character. To provide this capability, I used the following value for my ValidationExpression:
^.{1,25}$
Now, if I did want to limit the type of characters entered to be only alpha-numeric and empty spaces, I used the following:
^[a-zA-Z0-9 ]{1,25}$
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.