original_string: public function regexp($key, $value, $bool = "must", $filter = false, array $params = []) {
          if (is_array($key)) {
              return $this->multiRegexp($key, $value, $bool, $filter, $params);
          }
          if (is_array($value)) {
              return $this->regexps($key, $value, $bool, $filter, $params);
          }
          $this->addBool($this->makeFilteredQuery(["regexp" => [$key => ["value" => $value]]], $filter), $bool, $filter, $params);
          return $this;
      }
code: public function regexp($key, $value, $bool = "must", $filter = false, array $params = []) {
          if (is_array($key)) {
              return $this->multiRegexp($key, $value, $bool, $filter, $params);
          }
          if (is_array($value)) {
              return $this->regexps($key, $value, $bool, $filter, $params);
          }
          $this->addBool($this->makeFilteredQuery(["regexp" => [$key => ["value" => $value]]], $filter), $bool, $filter, $params);
          return $this;
      }
code_tokens: public function regexp ( $ key , $ value , $ bool = "must" , $ filter = false , array $ params = [ ] ) { if ( is_array ( $ key ) ) { return $ this -> multiRegexp ( $ key , $ value , $ bool , $ filter , $ params ) ; } if ( is_array ( $ value ) ) { return $ this -> regexps ( $ key , $ value , $ bool , $ filter , $ params ) ; } $ this -> addBool ( $ this -> makeFilteredQuery ( [ "regexp" => [ $ key => [ "value" => $ value ] ] ] , $ filter ) , $ bool , $ filter , $ params ) ; return $ this ; }
docstring: Creates a regexp query part.
  
  It will automatically detect the $key and $value types to create the
  required number of clauses, as follows:
  
  $key         $value      result
  
  single       single      {regexp:{$key:{regexp:$value}}}
  single       array       or:[regexp($key, $value[1]), ...]
  array        single      or:[regexp($key[1], $value), ...]
  array        array       or:[regexp($key[1], $value[1]),
  regexp($key[1], $value[2]), ...
  regexp($key[2], $value[1]), ... ]
  
  If $filter is true, it will enclose the regexp query with `query`
  filter and add it to the DSL query filter section instead the query
  section.
  
  @param string|string[] $key the key(s) to regexp search in.
  @param string|string[] $value the value(s) to regexp search against.
  @param string $bool severity of the query/filter. [must]|must_not|should
  @param bool $filter if true, DSL query filter section will be used after
  enclosing in a `query` filter.
  @param array $params extra parameters for the query tool
  @return QueryBuilder|static|self
docstring_tokens: Creates a regexp query part .