Thursday, April 21, 2011

help with regular pattern

this pattern will get me all files that begin with a nr and it works perfectly.

glob("path_to_dir/^[0-9]*");

but i want to have a pattern that gets me all files that ends with _thumbnail regardless file extension.

eg.

1.jpg
1_thumbnail.jpg
2.jpg
2_thumbnail.png

will get me

1_thumbnail.jpg
2_thumbnail.png

i have tried:

glob("path_to_dir/(_thumbnail)");

but it didnt work.

would appreciate a little help.

From stackoverflow
  • Will this do it?

    glob('path_to_dir/*_thumbnail.*');
    
    neo : This look like wildcards, not regular expressions...
    weng : it did perfeclty=)

0 comments:

Post a Comment