Advertisement
Stan08

MoreRegex/5.OnlyLetters

Jun 25th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using System.Linq;
  4. using System.Globalization;
  5. using System.Collections.Generic;
  6. using System.Text;
  7.  
  8. public class Example
  9.  
  10. {
  11. public static void Main(string[] args)
  12.  
  13. {
  14. string input = Console.ReadLine();
  15.  
  16. string pattern = @"(\d+)([A-Za-z])";
  17.  
  18. MatchCollection m = Regex.Matches(input,pattern);
  19. StringBuilder result = new StringBuilder(input);
  20.  
  21. foreach (Match currM in m)
  22. {
  23. result.Replace(currM.Groups[1].Value,currM.Groups[2].Value);
  24. }
  25.  
  26. Console.WriteLine(result);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement