123456789101112131415161718192021222324252627282930313233343536373839404142 |
- [discrete]
- [[esql-like-operator]]
- === `LIKE`
- // tag::body[]
- Use `LIKE` to filter data based on string patterns using wildcards. `LIKE`
- usually acts on a field placed on the left-hand side of the operator, but it can
- also act on a constant (literal) expression. The right-hand side of the operator
- represents the pattern.
- The following wildcard characters are supported:
- * `*` matches zero or more characters.
- * `?` matches one character.
- include::./types/like.asciidoc[]
- [source.merge.styled,esql]
- ----
- include::{esql-specs}/docs.csv-spec[tag=like]
- ----
- [%header.monospaced.styled,format=dsv,separator=|]
- |===
- include::{esql-specs}/docs.csv-spec[tag=like-result]
- |===
- Matching the exact characters `*` and `.` will require escaping.
- The escape character is backslash `\`. Since also backslash is a special character in string literals,
- it will require further escaping.
- [source.merge.styled,esql]
- ----
- include::{esql-specs}/string.csv-spec[tag=likeEscapingSingleQuotes]
- ----
- To reduce the overhead of escaping, we suggest using triple quotes strings `"""`
- [source.merge.styled,esql]
- ----
- include::{esql-specs}/string.csv-spec[tag=likeEscapingTripleQuotes]
- ----
- // end::body[]
|