usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Text.RegularExpressions;namespace_17._5 substitution of regular expressions {classProgram {Static voidMain (string[] args) { stringinput ="Welcome to ***ww****w*********************"; stringPattern =@"\bw{3}\.\w+\. (com|net|org) \b"; stringReplacment ="\ n"+@"http://$&"; Console.WriteLine ("the string before the substitution"+input); Console.WriteLine ("the replaced string"); Console.WriteLine (Regex.Replace (input,pattern,replacment)); Console.WriteLine ("replaced with string 1:"+(Regex.Replace (input,pattern,replacment,regexoptions.ignorecase)). ToLower ()); Console.WriteLine ("replaced with string 2:"+regex.replace (Input,"www","\ n"+@"http://www.", regexoptions.ignorecase)); Regex Myregex=NewRegex (pattern,regexoptions.ignorecase); stringresult =Myregex. Replace (input, replacment); Console.WriteLine ("replaced with string 3:"+result. ToLower ()); Console.readkey (); } }}
17._5 replacement of regular expressions