locked
Validation RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I have below function for Alphabet check . I want Space option also to be given

    public class CommonFunction
        {
            public static string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            public bool IsAlpha(string input)
            {
                return Regex.IsMatch(input, "^[a-zA-Z]+$");
            }
    
        }

    Thanks

    Thursday, August 16, 2018 5:05 PM

Answers

  • User2103319870 posted

    I want Space option also to be given

    You can add a space to Regex like below

     public class CommonFunction
            {
                public static string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                public bool IsAlpha(string input)
                {
                    return Regex.IsMatch(input, "^[a-zA-Z ]+$");
                }
            }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 16, 2018 5:59 PM