Part of elisa.core.pattern_matcher View In Hierarchy
Known subclasses: elisa.core.pattern_matcher.UriPatternMatcher
Line # | Kind | Name | Docs |
---|---|---|---|
80 | Method | __init__ | Undocumented |
83 | Method | add_pattern | Assign an object to a regex pattern. |
96 | Method | remove_pattern | Remove a regex pattern. |
114 | Method | match | Match string to the list of patterns in the resolver and
return the |
Parameters | regex | regular expression
(type: str
) |
obj | the object to assign to strings matching regex
(type: any python object
) |
Parameters | regex | regular expression
(type: str
) |
Raises | PatternNotFound | when the pattern is not found |
string
to the list of patterns in the resolver and
return the associated object.
This tries to match the pattern against the whole string, and not only
the beginning of the string as re.match()
does. Append '.*' to
your regular expression if you want the same behaviour as
re
.
Parameters | string | string to match
(type: str
) |
all | whether to return all the matches or only the first one
(type: bool
) | |
Raises | MatchNotFound | there was no match for the given string |