Skip to main content

ARGREP

Search array values using one or more predicates.
1 min read

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

Arguments#

keystrrequired#

The array key.

startint | Literal['-']required#

The first index to search. Use "-" for the lowest possible index.

endint | Literal['+']required#

The last index to search. Use "+" for the highest possible index.

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

exactstr | List[str]#

Match the whole value.

matchstr | List[str]#

Match a substring.

globstr | List[str]#

Match a glob pattern.

regexstr | List[str]#

Match a regular expression.

combineLiteral['AND', 'OR']#

How to combine predicates. Defaults to OR.

nocasebool#

Match case-insensitively. Defaults to False.

withvaluesbool#

Return index-value tuples instead of indexes. Defaults to False.

limitint#

Maximum number of matches. If provided, it must be greater than zero.

Response#

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.

See the server command reference for protocol details.

Was this page helpful?