Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Utils
- {
- public static class Util
- {
- public static string GetFirstMatch(string pattern, string s, int index, bool removeDots = false)
- {
- if (s == null) return null;
- Regex regex = new Regex(pattern);
- Match m = regex.Match(s);
- while (m.Success)
- {
- if (removeDots)
- return m.Groups[index].Value.Replace(".", "");
- return m.Groups[index].Value;
- }
- return null;
- }
- }
- }
Add Comment
Please, Sign In to add comment