Escape non-regular expression parts
Created by: martinpengellyphillips
If head
or tail
contain characters that can be interpreted as regular expression patterns then the match case can fail.
For example:
>>> collection = Collection('prefix\\file.', '.jpg', 0, [1])
>>> print 'prefix\\file.1.jpg' in collection
False
The above should result in True.
To solve, just use re.escape
on head and tail when updating expression.