p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET Web Pages with WebMatrix (http://p2p.wrox.com/forumdisplay.php?f=662)
-   -   Chapter 4:Reusable function (http://p2p.wrox.com/showthread.php?t=86117)

hozdaman December 21st, 2011 01:57 PM

Chapter 4:Reusable function

First I would like to say I really like this book. Thanks.

I am having trouble with the reusable function. The email address is coming out false everything looks okay to me.


@using System.Text.RegularExpressions;

@functions {
    public static bool IsValidEmail(string s)
        string pattern = @"^[\w-\.]+@ ([\w-]+\.)+[\w-]{2,4}$";
        return Regex.IsMatch(s,pattern);

Please help. Thanks.

Mike Brind December 22nd, 2011 05:22 AM

You have a space after the @ sign in your pattern variable. Remove that and it should work.

All times are GMT -4. The time now is 08:21 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.