<span class="q"><span>> I know I can use a variable in regular expressions. I want to use a<br>> regex to find something based on the beginning of the string. I am<br>> using yesterday's date to find all of my data from yesterday.
<br>> Yesterday's date is 20070731, and assigned to the variable<br>> "yesterday_date". I want to loop thru a directory and find all of the<br>> yesterday's data ONLY IF the feature class has the date at the
<br>> BEGINNING of the filename.</span><br><br></span>If i understood, you have directores with files named 20070731, 20070722 ...<br><br>So, what about:<br><br>import os<br>yesterday_date = '20070731'<br>list = 
os.listdir
(dir)<br>for x in [x for x in list if x.startswith( yesterday_date ) ]:<br>    print x<br><br><br>Is  not a option?<br><br>[]'s<br>