Overview
Extended Pattern Matching.
Functions:
| Name | Description |
|---|---|
is_pattern |
Return |
match |
Return |
matchs |
Return |
matchsp |
Return matching pattern if |
Attributes:
| Name | Type | Description |
|---|---|---|
matches |
Alias to matchs. |
|
matchespat |
Alias to matchsp. |
match
Return True if name matches pattern.
Pattern may contain * and ?. * matches any characters, ? matches exactly one character.
>>> match('foo', 'foo')
True
>>> match('foo', '*')
True
>>> match('foo', 'bar*')
False
>>> match('foo', 'fo?')
True
matchs
Return True if name matches element of patterns.
Pattern may contain * and ?. * matches any characters, ? matches exactly one character.
>>> matchs('foo', ['foo', 'bar'])
True
>>> matchs('foo', ['*'])
True
>>> matchs('foo', ['bar*', 'baz'])
False
>>> matchs('ba', ['bar*', 'baz'])
False
>>> matchs('baz', ['bar*', 'baz'])
True
>>> matchs('baz2', ['bar*', 'baz'])
False
matches is an alias to matchs
>>> matches('foo', ['foo', 'bar'])
True
matchsp
Return matching pattern if name matches element of patterns.
Pattern may contain * and ?. * matches any characters, ? matches exactly one character.
>>> matchsp('foo', ['foo', 'bar'])
'foo'
>>> matchsp('foo', ['*'])
'*'
>>> matchsp('foo', ['bar*', 'baz'])
>>> matchsp('ba', ['bar*', 'baz'])
>>> matchsp('baz', ['bar*', 'baz'])
'baz'
>>> matchsp('baz2', ['bar*', 'baz'])
matchespat is an alias to matchsp
>>> matchespat('foo', ['foo', 'bar'])
'foo'