Advertisement
dinko_dt

Untitled

Mar 24th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6.  
  7.  
  8. namespace ConsoleApp2
  9. {
  10. class Exercise
  11. {
  12. static void Main()
  13. {
  14.  
  15. string text = "Dinko Delchev Trendafilov from Dimitrovgrad born 1979 year.Phone number is 0988719221.";
  16. string pattern = @"(?<names>[A-Z][a-z]+)(?<digits>\d+)";
  17.  
  18. var result = Regex.Matches(text, pattern);
  19.  
  20. foreach (Match item in result)
  21. {
  22. Console.WriteLine(item.Groups["names"].Value);
  23. Console.WriteLine(item.Groups["digits"].Value);
  24.  
  25. }
  26.  
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement