This is weird. I have a script that checks walks through directories, checks to see if their name matches a certain format ( regular expression ), and then prints out what it finds. However, it refuses to ever match on numbers unless the regexp is ".*". So far I have tried the following regular expressions: "\d+" "\d*" "\W+" "\W*" "[1-9]+" and more...
Here is an example of the output: No Match on partners80_access_log.1102723200 Checking on type=<type 'str'> Name = some_access_log.1102896000 Here is the code: import os,sys import re #define the file mask to identify web log files regexp = re.compile( r"\." ) startdir = "C:/Documents and Settings/John.Gooch/My Documents/chaser/" #define global functions def delFile(arg, dirname, names): found = 0 for name in names: print "Checking on type="+str(type( name ) )+" Name = "+str(name) matches = re.compile(r"([\w]+)").match( name ) if matches: print "Match on "+str(matches.groups()) found = 1 else: print "No Match on "+name if not found: print "No matches found in "+dirname else: print "Match found in "+dirname os.path.walk( startdir, delFile, "" ) Any thoughts? _______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor