Guest User

Untitled

a guest
Feb 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. namespace Utils
  2. {
  3. public static class Util
  4. {
  5. public static string GetFirstMatch(string pattern, string s, int index, bool removeDots = false)
  6. {
  7. if (s == null) return null;
  8. Regex regex = new Regex(pattern);
  9. Match m = regex.Match(s);
  10. while (m.Success)
  11. {
  12. if (removeDots)
  13. return m.Groups[index].Value.Replace(".", "");
  14. return m.Groups[index].Value;
  15. }
  16. return null;
  17. }
  18. }
  19. }
Add Comment
Please, Sign In to add comment