I know I can use a variable in regular expressions. I want to use a regex to find something based on the beginning of the string. I am using yesterday's date to find all of my data from yesterday. Yesterday's date is 20070731, and assigned to the variable "yesterday_date". I want to loop thru a directory and find all of the yesterday's data ONLY IF the feature class has the date at the BEGINNING of the filename.
Sample strings: 20070731_test1 Copy20070731_test1 20070731_test2 Copy20070731_test2 20070731_test3 Copy20070731_test3 I don't want the one's that start with "Copy". I can't figure out the syntax of inserting the "^" into the regex. I've tried all of the following, with no luck: re.compile(^yesterday_date) re.compile(r'^yesterday_date') re.compile(r'^[yesterday_date]') re.compile(r'[^yesterday_date]') I don't know what I'm doing and I'm just guessing at this point. Can anyone help? Thanks. Mark -- http://mail.python.org/mailman/listinfo/python-list