using System.Text.RegularExpressions;
public static void Main()
var speed2 = "Broadband - 1000 Mbps / 30 Mbps";
var speed = "2 T1s - 3.0 Mbps";
var speed3 = "Gig-E - 10000 Mbps";
var speed4 = "Fast-E - 5 Mbps";
Regex MbpsRegex2 = new Regex("(\\d+(\\.\\d+)?) Mbps");
MatchCollection MbpsMatches = MbpsRegex2.Matches(speed);
MatchCollection MbpsMatches2 = MbpsRegex2.Matches(speed2);
if (MbpsMatches.Count == 0)
Console.WriteLine(@"Excluded because no matches.");
Console.WriteLine(MbpsMatches[0].ToString().Replace(" Mbps", ""));
if (MbpsMatches2.Count == 0)
Console.WriteLine(@"Excluded because no matches.");
Console.WriteLine(MbpsMatches2[0].ToString().Replace(" Mbps", ""));