Advertisement
Guest User

Untitled

a guest
Feb 21st, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Text.RegularExpressions;
  7.  
  8. class MatchFullName
  9. {
  10. static void Main()
  11. {
  12. string input = "ivan ivanov, Ivan ivanov, ivan Ivanov, IVan Ivanov, Ivan IvAnov, Ivan Ivanov, Ivan IvanOV";
  13. string pattern = @"\b[A-Z][a-z]+\s[A-Z][^A-Z][a-z]+\b";
  14. Regex regex = new Regex(pattern);
  15. MatchCollection matches = regex.Matches(pattern);
  16.  
  17. foreach (MatchCollection match in matches)
  18. {
  19. Console.Write(matches + " ");
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement