fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. string text = @"Контакты в Москве tel:123-45-67, 123-34-56; fax:123-56-45.
  9. Контакты в Саратове tel:12-34-56; fax:12-56-45";
  10. Console.WriteLine("Старые данные " + text);
  11.  
  12. // Удаляем "tel" и "fax" с двоеточием, если оно присутствует.
  13. string newText = Regex.Replace(text, @"\b(tel|fax):?\s*", "", RegexOptions.IgnoreCase);
  14. Console.WriteLine("Новые данные " + newText);
  15. }
  16. }
  17.  
  18.  
  19.  
Success #stdin #stdout 0.09s 33580KB
stdin
Standard input is empty
stdout
Старые данные Контакты в Москве tel:123-45-67, 123-34-56; fax:123-56-45. 
            Контакты в Саратове tel:12-34-56; fax:12-56-45
Новые данные Контакты в Москве 123-45-67, 123-34-56; 123-56-45. 
            Контакты в Саратове 12-34-56; 12-56-45