This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Alberto Galera
Recipients Alberto Galera
Date 2015-11-25.14:43:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1448462626.73.0.555480375618.issue25734@psf.upfronthosting.co.za>
In-reply-to
Content
# https://hg.python.org/cpython/file/tip/Lib/fnmatch.py
fnmatch reviewing the code I've noticed that the outcome of the regular expression all returns generated in the first result

l97:
            res = res + '.*'
to:
            res = res + '.*?'

l100:
    return res + '\Z(?ms)'
to:
    return res + '$(?ms)'


example test:

import re
import fnmatch

urls = ['example/l1/l2/test3-1.py',
        'example/l1/test2-1.py',
        'example/l1/test2-2.py',
        'example/l1/l2/l3/test4-1.py']

regex = fnmatch.translate('example/*')
# 'example\\/.*\\Z(?ms)'
re.findall(regex, "\n".join(urls))
# return ['example/l1/l2/test3-1.py\nexample/l1/test2-1.py\nexample/l1/test2-2.py\nexample/l1/l2/l3/test4-1.py']

# suggested change 
re.findall('example\\/.*?$(?ms)', "\n".join(urls))
# return ['example/l1/l2/test3-1.py',
#         'example/l1/test2-1.py',
#         'example/l1/test2-2.py',
#         'example/l1/l2/l3/test4-1.py']
History
Date User Action Args
2015-11-25 14:43:46Alberto Galerasetrecipients: + Alberto Galera
2015-11-25 14:43:46Alberto Galerasetmessageid: <1448462626.73.0.555480375618.issue25734@psf.upfronthosting.co.za>
2015-11-25 14:43:46Alberto Galeralinkissue25734 messages
2015-11-25 14:43:46Alberto Galeracreate