New submission from mstol:

I'm not sure if this is real bug, but the documentation of fnmatch.translate 
states:

fnmatch.translate(pattern)

    Return the shell-style pattern converted to a regular expression.



My intuition about shell-style pattern is that for example, pattern:t3
should match only t3, and not ost3 or xxxxxt3, but what I receive from fnmatch 
is:
In [2]: fnmatch.translate("t3")
Out[2]: 't3\\Z(?ms)'

so using for example re.search will match not only on t3, but also on xxxt3 (in 
shell-like pattern is *t3). So... I  believe it should be changed or at least 
the documentation should be more specific about what "shell-style pattern" mean.

----------
components: Regular Expressions
messages: 231712
nosy: ezio.melotti, mrabarnett, mstol
priority: normal
severity: normal
status: open
title: fnmatch.translate doesn't add ^ at the beginning
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22949>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to