kruegerste
asked on
Regular Expression - Allow White Spaces
I have an asp.net control using a regular expression for validation, it is for an email address. It allows alphanumeric and also allows 1 character domain names.
I need to modify it to also allow white spaces at the beginning and end of it (but not anywhere in the middle). Not sure how to do this, I have tried and have failed miserably thus far.
Here is the current expression which works as desired but new request for white spaces means it needs to be updated:
Public Const REG_EMAIL As String = "^\w+([-+.]\w+)*@\w+([-.]\ w+)*\.\w+( [-.]\w+)*$ "
Thanks in advance, I hope someone can help.
I need to modify it to also allow white spaces at the beginning and end of it (but not anywhere in the middle). Not sure how to do this, I have tried and have failed miserably thus far.
Here is the current expression which works as desired but new request for white spaces means it needs to be updated:
Public Const REG_EMAIL As String = "^\w+([-+.]\w+)*@\w+([-.]\
Thanks in advance, I hope someone can help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome, thanks. Works perfect.
NP. Glad to help :)
ASKER