harish reddy

harish reddy

  • NA
  • 162
  • 33.9k

Regular expression question

Apr 6 2018 7:06 AM
string text = "Please contact us by phone (+001 222 222 222) or by email at [email protected] or at [email protected]. This is not email: test@test. This also: @gmail.com. Neither this: [email protected].";
string format = "^[a-zA-Z]{1,15}.[a-zA-Z]{1,15}@[a-zA-Z]{1,10}.(com|in|org|co|uk).(uk)$";
MatchCollection first = Regex.Matches(text, format, RegexOptions.None);
Console.WriteLine(first[0]);
Console.WriteLine(first[1]);
 
 
My xpected output is  [email protected] and [email protected]..
But i am not getting pls help 

Answers (1)