using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
string input = "I have hundreds of thousands of files and easily 80% of them have a resolution in the file name, for example 128x128 or 270x360. I'm renaming all these files based on meta data but want to preserve the resolution. Example file names:Grey Skyies 128x128.jpg. Rainbow Heaven 270x360.png Happy Puppy 100x100 Blah Blah Blah.gif";
string pattern = @"\d+x\d+";
MatchCollection matches = Regex.Matches(input, pattern);
foreach (Match match in matches)
{
Console.WriteLine(match.Value);
}
}
}