Determine if id matches the pattern, or vice versa, allowing for
regular expressions.
This method converts from relax's RE syntax to that of the re python
module.
The changes include:
-
All '*' to '.*'.
-
The identifier is bracketed, '^' is added to the start and '$' to the
end.
After conversion of both the string and patterns, the comparison is
then performed both ways from the converted string matching the original
string (using re.search()).
- Parameters:
pattern (anything) - The pattern to match the string to. This can be a list of
patterns. All elements will be converted to strings, so the
pattern or list can consist of anything.
id (None, str, or number) - The identification object.
- Returns: bool
- True if there is a match, False otherwise.
|