docs: def __regex(self, path, text, pattern, filter, annotators=None, properties=None):
          """Send a regex-related request to the CoreNLP server.
          :param (str | unicode) path: the path for the regex endpoint
          :param text: raw text for the CoreNLPServer to apply the regex
          :param (str | unicode) pattern: regex pattern
          :param (bool) filter: option to filter sentences that contain matches, if false returns matches
          :param properties: option to filter sentences that contain matches, if false returns matches
          :return: request result
          """
          self.ensure_alive()
          if properties is None:
              properties = self.default_properties
              properties.update({
                  'annotators': ','.join(annotators or self.default_annotators),
                  'inputFormat': 'text',
                  'outputFormat': self.default_output_format,
                  'serializer': 'edu.stanford.nlp.pipeline.ProtobufAnnotationSerializer'
              })
          elif "annotators" not in properties:
              properties.update({'annotators': ','.join(annotators or self.default_annotators)})
  
          # HACK: For some stupid reason, CoreNLPServer will timeout if we
          # need to annotate something from scratch. So, we need to call
          # this to ensure that the _regex call doesn't timeout.
          self.annotate(text, properties=properties)
  
          try:
              # Error occurs unless put properties in params
              input_format = properties.get("inputFormat", "text")
              if input_format == "text":
                  ctype = "text/plain; charset=utf-8"
              elif input_format == "serialized":
                  ctype = "application/x-protobuf"
              else:
                  raise ValueError("Unrecognized inputFormat " + input_format)
              # change request method from `get` to `post` as required by CoreNLP
              r = requests.post(
                  self.endpoint + path, params={
                      'pattern': pattern,
                      'filter': filter,
                      'properties': str(properties)
                  }, data=text,
                      headers={'content-type': ctype},
                      timeout=(self.timeout*2)/1000,
                      )
              r.raise_for_status()
              return json.loads(r.text)
          except requests.HTTPError as e:
              if r.text.startswith("Timeout"):
                  raise TimeoutException(r.text)
              else:
                  raise AnnotationException(r.text)
          except json.JSONDecodeError:
              raise AnnotationException(r.text)