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
I was hoping RegEx could help to find that pattern nnnxnnn so I can pull that out and store it (vb.net variable) to later rename the file preserving that resolution.
Use regex pattern: \d+x\d+
Which match
string pattern = @"\d+x\d+";
MatchCollection matches = Regex.Matches(input, pattern);
foreach (Match match in matches) {
Console.WriteLine(match.Value);
}