Ensures :attr:`subject` matches regular expression *pattern*.

def matches(self, pattern, flags=0):
        """
        Ensures :attr:`subject` matches regular expression *pattern*.
        """
        if not re.match(pattern, self._subject, flags):
            raise self._error_factory(_format("Expected {} to match {}", self._subject, pattern))
        return ChainInspector(self._subject)