public static string GetYouTubeStandardChannelId(this string str) { if (str == null) { return(null); } var match = YouTubeChannelIdRegex.Match(str); if (!match.Success || match.Groups["id"].Captures.Count != 1) { return(null); } return(match.Groups["id"].Captures[0].Value); }
// Extension methods public static bool IsValidYouTubeChannelUrl(this string str) { return(YouTubeChannelIdRegex.IsMatch(str)); }