Wednesday, June 23, 2010

Validation expression to check Minimum length of 5 with trimming both ends

After spending some time I've been able to derive this expression:

ValidationExpression="^[\s]*[\x21-\x7E][\x20-\x7E]{3,}[\x21-\x7E][\s]*$"

It ignores if there is space/ tab at the beginning or at the end of the string. But it adds spaces in account if they come in between the beginning and ending charaters.

No comments: