regex problem with re and fnmatch
f.braennstroem at gmx.de
Tue Nov 20 22:05:58 CET 2007
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:
I tried to use these kind of matchings:
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
for name in dirs:
dirs=os.path.join(root, name) + '/'
for name in files:
if fnmatch.fnmatch(str(files), "README*"):
print "File Found"
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?
More information about the Python-list