Regular Expression - Allow White Spaces
Posted on 2009-12-17
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.