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