Skip to main content
Use ARGREP to find the array slots whose value matches one or more predicates. Each predicate is a keyword and a pattern: EXACT compares the whole value, MATCH looks for a substring, GLOB applies a glob pattern with * and ?, and RE applies a regular expression. Several predicates can be given in one call; by default a slot matches when any of them matches, and AND switches that to requiring all of them. NOCASE makes every predicate in the call case-insensitive. The bounds accept - and + as shorthand for the first and last possible index, so a whole array can be searched without knowing its extent. By default the reply is the list of matching indexes; WITHVALUES returns index-value pairs instead, which saves a follow-up ARMGET when you need the data as well as its position. See the array command overview for the data model these commands share.

Syntax

Arguments

Important points

  • At least one predicate is required, and a call may carry at most 250 of them.
  • A regular expression may be at most 2048 bytes long, and backreferences (\1 through \9) are not supported.
  • AND and OR apply to the whole call, not to the predicate they follow.

Response

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
This command is not supported yet in @upstash/redis.
This command is not supported yet in upstash_redis.