I have a list of strings from os.listdir containing file/directory names. What I'm looking for is any file that matches a particular pattern, but so far I've been unable to get anything less than a perfect match using the 're' module.

Using Python 2.7.5, I need to search a list of 300+ strings and find any string that matches my filename, however, my filename has some dynamic components.

Typical logfile name:

20130703_d3rp_3088_0.log

the 'd3rp' and .log are the only static components - the date at the beginning changes, 3088 is the PID of the process creating the logfile, and the _0 is a version, as the logfile spawns _1, _2 every 10mb or so.

However, so far I can only find the file if I specify the precise filename, which is useless when it changes daily (and sometimes hourly). I have the following code which works fine if I precisely specify the whole filename, but so far I've been unable to find the correct regular expression syntax to essentially find '*d3rp*.log'.