Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- namespace ConsoleApplication3
- {
- class Program
- {
- static void Main(string[] args)
- {
- string inputWord = Console.ReadLine();
- string input = Console.ReadLine();
- string pattern = string.Format(@"[\w\s]+{0}[\w\s]+[.!?](?=\s)|{1}[\w\s]+[.!?](?=\s)", inputWord, inputWord);
- Regex regex = new Regex(pattern);
- foreach (var item in regex.Matches(input))
- {
- Console.WriteLine(item);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment