Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- public class Example
- {
- public static void Main()
- {
- string word = Console.ReadLine();
- string pattern = $@"(\.|\?|!|)([\w@#$%^&*()\-=+`~\s]+\ {word} [\w\s@#$%^&*()\-=+`~]+)(\.|!|\?|)";
- string input = Console.ReadLine();
- foreach (Match m in Regex.Matches(input, pattern))
- {
- if (m.Groups[2].Success)
- {
- Console.WriteLine(m.Groups[2].Value.Trim());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement