# `like`

_Whether text matches a pattern_
```syntax
x like y    like[x;y]
```

Where

- `x` is a symbol or string
- `y` is a pattern as a string

returns a boolean: whether `x` matches the pattern of `y`. Matching is case-sensitive.
```q
q)`quick like "qu?ck"
1b
q)`brown like "br[ao]wn"
1b
q)`quickly like "quick*"
1b
q)`quick like "Qu*"
0b
q)"a*b" like "a[*]b"     / match a pattern character literally
1b
```

If `y` contains no [pattern characters](regex.md), `like` is equivalent to `{y~string x}`.
```q
q)`quick like "quick"
1b
q)`quick like "quickish"
0b
```

## Implicit iteration

`like` applies to lists of strings or symbols, and to dictionaries with them as values.
```q
q)`brawn`brown like "br[^o]wn"
10b

q)(`a`b`c!`quick`brown`fox)like "brown"
a| 0
b| 1
c| 0
```

## Perl-compatible regular expressions

`like` supports only a limited set of [pattern characters](regex.md). For full regular expressions, including alternation, optional items, repetition counts, and case-insensitive matching, use the [PCRE2 module](../modules/pcre2/overview.md).
```q
q)`colour`Color like "colo*r"
10b
q)pcre2:use`kx.fusion:pcre2
q)pcre2.match["colou?r";"Colour or color";`caseless]
x0| "Colour" 0  6  "color"  10 15
```

----

[`ss`, `ssr`](ss.md)


[Regular expressions in q](regex.md),
[PCRE2 module](../modules/pcre2/overview.md),
[Strings](by-topic.md#strings)
