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