Regular expression to exclude.
| 286 | |
| 287 | |
| 288 | class RegexPattern(PatternBase): |
| 289 | """Regular expression to exclude.""" |
| 290 | |
| 291 | PREFIX = "re" |
| 292 | |
| 293 | def _prepare(self, pattern): |
| 294 | self.pattern = pattern # / at beginning is NOT removed |
| 295 | self.regex = re.compile(pattern) |
| 296 | |
| 297 | def _match(self, path): |
| 298 | assert "\\" not in path |
| 299 | return self.regex.search(path) is not None |
| 300 | |
| 301 | |
| 302 | _PATTERN_CLASSES = {FnmatchPattern, PathFullPattern, PathPrefixPattern, RegexPattern, ShellPattern} |
no outgoing calls