Meenalu
asked on
Regular expression to validate trailing and leading spaces - ASP.NET
Hello,
i am using this regex
ValidationExpression="^([0 -9a-zA-Z]( [-.\w]*[0- 9a-zA-Z])* @(?:kellog g\.northwe stern\.edu |tuck\.dar tmouth\.ed u|georgeto wn\.edu))"
how to validate leading and trailing spaces (before and after email address) also?
-meenalu
i am using this regex
ValidationExpression="^([0
how to validate leading and trailing spaces (before and after email address) also?
-meenalu
ASKER
Stephanonline,
should my validator be like this:
I have added (\s*) after "^" and before we end the expression. Is this correct. Do i have to use two (\s*) . please check and let me know if the expression is correct.
ValidationExpression="^(\s *) ([0-9a-zA-Z]([-.\w]*[0-9a- zA-Z])*@(? :kellogg\. northweste rn\.edu|tu ck\.dartmo uth\.edu|g eorgetown\ .edu))(\s* ) "
meenalu
should my validator be like this:
I have added (\s*) after "^" and before we end the expression. Is this correct. Do i have to use two (\s*) . please check and let me know if the expression is correct.
ValidationExpression="^(\s
meenalu
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much, stephanonline.
-Meenalu
-Meenalu
You could use (\s*) when there is zero or more spaces
Or you can use (\s+) equals 1 or more spaces