> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-dx-3009-array-sdk-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ARGREP

> Search array values using one or more predicates.

Provide at least one predicate and at most 250. Regular expressions are limited to 2048 bytes and do not support backreferences.

## Arguments

<ParamField body="key" type="str" required>
  The array key.
</ParamField>

<ParamField body="start" type="int | Literal['-']" required>
  The first index to search. Use `"-"` for the lowest possible index.
</ParamField>

<ParamField body="end" type="int | Literal['+']" required>
  The last index to search. Use `"+"` for the highest possible index.
</ParamField>

The following arguments are keyword-only. Each predicate accepts one pattern or a list of patterns.

<ParamField body="exact" type="str | List[str]">
  Match the whole value.
</ParamField>

<ParamField body="match" type="str | List[str]">
  Match a substring.
</ParamField>

<ParamField body="glob" type="str | List[str]">
  Match a glob pattern.
</ParamField>

<ParamField body="regex" type="str | List[str]">
  Match a regular expression.
</ParamField>

<ParamField body="combine" type="Literal['AND', 'OR']">
  How to combine predicates. Defaults to OR.
</ParamField>

<ParamField body="nocase" type="bool">
  Match case-insensitively. Defaults to False.
</ParamField>

<ParamField body="withvalues" type="bool">
  Return index-value tuples instead of indexes. Defaults to False.
</ParamField>

<ParamField body="limit" type="int">
  Maximum number of matches. If provided, it must be greater than zero.
</ParamField>

## Response

<ResponseField type="List[int] | List[Tuple[int, str]]" required>
  Matching indexes, or index-value pairs when values are requested. TypeScript returns indexes as strings; Python returns integers. No matches returns an empty list.
</ResponseField>

<RequestExample>
  ```py Example theme={"system"}
  redis.arset("logs", 0, "error: disk", "ok", "ERROR: network")
  print(redis.argrep("logs", "-", "+", match="error", nocase=True))  # [0, 2]

  print(redis.argrep(
      "logs", "-", "+",
      glob="error:*", match="disk", combine="AND", withvalues=True, limit=10,
  ))  # [(0, "error: disk")]
  ```
</RequestExample>

See the [server command reference](/redis/commands/array/argrep) for protocol details.
