11,567 questions
I did it with indexof and substring and it's working fine at least for my case :
public List<string> GetLinks(string message)
{
List<string> list = new List<string>();
string txt = message;
foreach (Match item in Regex.Matches(txt, @"(http|ftp|https):\/\/([\w\-_]+(?:(?:\.[\w\-_]+)+))([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?"))
{
if (item.Value.Contains("thumbs"))
{
int index1 = item.Value.IndexOf("mp4");
if (index1 != -1)
{
string result = item.Value.Substring(0, index1 + 3);
list.Add(result);
}
}
}
return list;
}