The RegularExpressionValidator email regex does not validate all valid e-mailaddresses

In a project I’ve been working on I discovered that the Visual Studo built in regex for email that you get when you work with the RegularExpressionValidator doesn’t work for some email addresses that actually are valid. This goes for email addresses that has for example a hyphen (-) or a dot (.) directly in front of the @, i.e.

The built in regular expression looks like this:


There are a lot of resources on RegEx on the web so I wont walk it through, let’s just take a look at the problem described above and modify it instead of googling up a working one.

The second instance of \w+ means word boundary, 1 or more times. Change this + to a * to say 0 or more times instead. So now the complete regular expression looks like this:


Now all I want is a way to save this change in Visual Studio.


  1. Iv made the changes as you said....and it works just fine..........Keep it up......

  2. Im no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that.

  3. It was wondering if I could use this write-up on my other website, I will link it back to your website though.Great Thanks.