using System.Text.RegularExpressions;
public static void Main()
string pattern1 = @"[a-z._0-9]+@[a-z0-9]+.\w{3}";
string input1 = @"this is jessikachrustel@gial.com sttudying in ku";
string pattern2 = @"\w{4}://+[a-z._0-9]+.\w{3}|\w{3}.+[a-z._0-9]+.\w{3}";
string input2= @"the url http://dotnet.net
http://mail.google.com www.karunya.edu";
string pattern3 = @"[a-z\w{2}[a-z]+\d{3}|\d{4}";
string input3= @"ur14cs251 ur14cs249 pr14cs2004 pr15cs2435";
MatchCollection mc1= Regex.Matches(input1, pattern1);
Console.WriteLine("the @gmail is given by :{0} " , m1.Value);
MatchCollection mc2= Regex.Matches(input2, pattern2);
Console.WriteLine("the url :{0} " , m2.Value);
MatchCollection mc3= Regex.Matches(input3, pattern3);
Console.WriteLine("the registernumber :{0} " , m3.Value);