Preg_match problem

Hello,

Files on directory like:

file1_100x75.jpg
file1_300x250.jpg

file11_100x75.jpg
file11_300x75.jpg

file_file1_100x75.jpg
file_file1_300x75.jpg

Lets say i want to filter only file1 with _(someSize)x(someSize)(.someFileExt)

So the result should only be

file1_100x75.jpg
file1_300x250.jpg

How should the pattern should be?

I am working on it for whole day. But couldn’t handle it.

Thank you

I think i made it:)


$filter = 'file1';

preg_match("/^($filter)(_.*x.*)$/", $file, $matches);

echo "<pre>";
print_r($matches);
echo "</pre>";