You'd need to use the proper type; the match object type is not explicitly importable, but you can use type()
on an existing instance to store it:
import re
MatchObject = type(re.search('', ''))
then use that in isinstance()
tests:
>>> MatchObject = type(re.search('', ''))
>>> isinstance(re.search('', ''), MatchObject)
True
There is nothing about C-defined Python types that prevents using isinstance()
otherwise.