Advertisement
Guest User

Домашно Strings and Text Processing - 14 задача

a guest
Jan 17th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Text.RegularExpressions;
  4.  
  5. class Program
  6. {
  7.     static void Main()
  8.     {
  9.         StringBuilder text = new StringBuilder();
  10.         text.Append(".NET – platform for applications from Microsoft\r\n");
  11.         text.Append("CLR – managed execution environment for .NET\r\n");
  12.         text.Append("namespace – hierarchical organization of classes\r\n");
  13.  
  14.         string wordSearch = Console.ReadLine();
  15.         string pattern = @"^" + wordSearch + @" (-|–) ?.*";
  16.         Console.WriteLine(Regex.Match(text.ToString(), pattern, RegexOptions.Multiline).Value);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement