Skip to content
This repository has been archived by the owner on Dec 13, 2019. It is now read-only.

fnmatch_translate_extended() incorrectly translates wildcard pattern #380

Open
ericzundel opened this issue Jun 12, 2015 · 1 comment
Open

Comments

@ericzundel
Copy link
Contributor

I found that the fnmatch_translate_extended translation of the pattern 'squareup/inventory/adjustment*.proto' to a regular expression did not match the string 'squareup/inventory/adjustment.proto'

This is because the re returned expects at least one character to replace '*' in the expression above:

from twitter.common.dirutil.fileset import fnmatch_translate_extended
pattern = fnmatch_translate_extended('squareup/inventory/adjustment*.proto')
(Pdb) p pattern
u'squareup\\/inventory\\/adjustment([^/]+)\\.proto\\Z(?ms)'

A better translation would be to replace the '+' with '*':

u'squareup\\/inventory\\/adjustment([^/]*)\\.proto\\Z(?ms)'
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant