Skip to content

Keep re.findall usage pattern? #4

@tovrstra

Description

@tovrstra

@agalera I noticed (because of a packaging issue) that pywildcard has a second distinction with Python's fnmatch, i.e. how the resulting regular expression can be used with re.findall:

import pywildcard
regex = pywildcard.translate('example/**')
re.findall(regex, "\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']

The usage pattern with re.findall does not work with Python's fnmatch. Is this difference intentional or just historical? In the latter case, I would suggest to make pywildcard more similar to fnmatch again, such that the following would work:

import pywildcard
import fnmatch
assert pywildcard.translate('example/**') == fnmatch.translate('example/*')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions