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!


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.