var regex = new Regex(@"twitter.com/.*/status(?:es)?/([^/?]+)", RegexOptions.IgnoreCase); var match = regex.Match(href); if (match.Success) { return match.Groups[1].Value; }