Hi, I would like to use re to search for lines in a files with the word "README_x.org", where x is any number. E.g. the structure would look like this: [[file:~/pfm_v99/README_1.org]]
I tried to use these kind of matchings: # org_files='.*README\_1.org]]' org_files='.*README\_*.org]]' if re.match(org_files,line): Unfortunately, it matches all entries with "README.org", but not the wanted number!? After some splitting and replacing I am able to check, if the above file exists. If it does not, I start to search for it using the 'walk' procedure: for root, dirs, files in os.walk("/home/fab/org"): for name in dirs: dirs=os.path.join(root, name) + '/' for name in files: files=os.path.join(root, name) if fnmatch.fnmatch(str(files), "README*"): print "File Found" print str(files) break As soon as it finds the file, it should stop the searching process; but there is the same matching problem like above. Does anyone have any suggestions about the regex problem? Greetings! Fabian -- http://mail.python.org/mailman/listinfo/python-list