Stumped: Regex works in C# but not VB - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Stumped: Regex works in C# but not VB

BrianBuBrianBu Posts: 2Member
I'm working through the Pro ASP.NET MVC Framework book by Apress (which is great, btw) and it's in C# although we mostly work in VB so I'm "translating" the examples along the way. So far so good but I ran into something that has thrown me.

Long story short we need to validate that the string the user gave us is an email address. This returns true in C#:

Console.WriteLine(System.Text.RegularExpressions.Regex.IsMatch("[email protected]", ".+\@.+\..+"));

But this returns false in VB:
Console.WriteLine(System.Text.RegularExpressions.Regex.IsMatch("[email protected]", ".+\@.+\..+"))

I'm sure I'm missing something small but it's giving me heartburn. Thanks in advance for any help.


Sign In or Register to comment.