Quote:
Originally Posted by michaelk
Individual's script fails because the file output is different from the expected regex expression. What compounds the problem is that there are two different aaxbb stings in the output.
Not enough information provided to be certain why the original script fails to find some files. It maybe caused if copying files to a directory within the original working search directory.
|
Yes, I failed to take into account file printing any metadata associated with the image, e.g. density, that is in the form WWxHH. The regex could be tweaked to handle those edge cases:
Code:
'(?<=, )\d+[ x]+\d+(?=,)'
An explanation for the OP:
Match a leading comma with a space, followed by one or more digits, followed by an optional space, the letter 'x', another optional space, one or more digits, and finally a trailing comma.
Here are some example output resolutions for images I tested with:
Code:
1920x1200
1920 x 1080
1920x1080
1680 x 1050
One caveat: you won't be able to match the resolution of a .tiff file using this regex.