Hi
I wanna validate a phone number. My condition is that I want mimimum 7 numbers in the given string, ignoring separators, X, parantheses.
Actually I want to achieve this function in regex:
Func<string, bool> Validate = s => s.ToCharArray().Where(char.IsDigit).Count() >= 7;
Func<string, bool> RegexValidate = s => System.Text.RegularExpressions.Regex.IsMatch(s, @"regex pattern should come here.")
string x = "asda 1234567 sdfasdf";
string y = "asda sdfa 123456 sdfasdf";
bool xx = Validate(x); //true
bool yy = Validate(y); //false
The purpose of my need is I want to include this regex in an asp:RegularExpressionValidator