# selection.Selection.where

- **Module:** selection
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/selection.ts#L517
- **Page:** https://libtmux.org/en/ts/latest/reference/selection-selection-where/

```
where(criteria: WhereOf<Model>): Selection<Model>
```

Keep the members matching declarative criteria.

Criteria are data: equality, string operators, `AND`/`OR`/`NOT`, regular
expressions expressed as `{ pattern, flags }`, and quantifiers over
relations. Matching is case-sensitive unless a criterion says otherwise.

## Examples

```ts
snapshot.panes.where({ currentCommand: "vim" });
snapshot.windows.where({ name: { startsWith: "log" } });
```

## Type parameters

- [`Model`](/en/ts/latest/reference/selection-selection/#selection.Selection.type-parameter.Model), declared by [`Selection<Model>`](/en/ts/latest/reference/selection-selection/)

## Parameters

- `criteria` (`WhereOf<Model>`)

## Raises

- [`VersionTooLowError`](/en/ts/latest/reference/errors-versiontoolowerror/): when a criterion names a field newer than the tmux that answered. Such a field is not absent from the data, it is absent from that release, and matching it against nothing would answer "no member has this" — which is a different statement and the one a caller would act on. The error names the field, the release that has it, and the release running.

## Guides

Pages that discuss `where`.

- [Filtering and queries](/en/ts/latest/concepts/queries/)
