Reputation: 1030
i am using asp.net 3.5 and VB.net, i need a validation expression to validate a string of 1 to 50 characters, white spaces, numbers, special character are all allowed, simply, it should match an nvarchar(50) database field. it will be applied to a textbox, also, the same case but for 1-200 characters which will be validating a multi-line textbox..
Thanks in advance
Upvotes: 0
Views: 442
Reputation: 269658
Do you mean that it just needs to ensure that there are between 1 and 50/200 characters in the strings?
If so, try these:
^[\s\S]{1,50}$
^[\s\S]{1,200}$
Testing for [\s\S]
rather than [.]
ensures that any newlines in the multiline textarea don't cause problems.
Upvotes: 1