# 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="string" required>
  The array key.
</ParamField>

<ParamField body="start" type="number | string" required>
  The first index to search. Use `"-"` for the lowest possible index.
</ParamField>

<ParamField body="end" type="number | string" required>
  The last index to search. Use `"+"` for the highest possible index.
</ParamField>

<ParamField body="options" type="Object" required>
  <ParamField body="predicates" type="ArGrepPredicate[]" required>
    One to 250 predicates. Each is `{ exact: string }`, `{ match: string }`, `{ glob: string }`, or `{ re: string }` for equality, substring, glob, or regular-expression matching.
  </ParamField>

  <ParamField body="combine" type="'AND' | 'OR' | 'and' | 'or'">
    How to combine predicates. Defaults to OR.
  </ParamField>

  <ParamField body="noCase" type="boolean">
    Match case-insensitively. Defaults to false.
  </ParamField>

  <ParamField body="withValues" type="boolean">
    Return index-value pairs instead of indexes. Defaults to false.
  </ParamField>

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

## Response

<ResponseField type="string[] | [string, TData][]" 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>

Values use the SDK's automatic deserialization. Use `TData` to describe stored JSON values; it defaults to `string`.

<RequestExample>
```ts Example
await redis.arset("logs", 0, "error: disk", "ok", "ERROR: network");
console.log(await redis.argrep("logs", "-", "+", {
  predicates: [{ match: "error" }],
  noCase: true,
})); // ["0", "2"]

console.log(await redis.argrep("logs", "-", "+", {
  predicates: [{ 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.
