mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-25 07:37:19 -04:00
37 lines
1.1 KiB
Text
37 lines
1.1 KiB
Text
[discete]
|
|
[[esql-rlike-operator]]
|
|
==== `RLIKE`
|
|
|
|
// tag::body[]
|
|
Use `RLIKE` to filter data based on string patterns using using
|
|
<<regexp-syntax,regular expressions>>. `RLIKE` 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.
|
|
|
|
include::./types/like.asciidoc[]
|
|
|
|
[source.merge.styled,esql]
|
|
----
|
|
include::{esql-specs}/docs.csv-spec[tag=rlike]
|
|
----
|
|
[%header.monospaced.styled,format=dsv,separator=|]
|
|
|===
|
|
include::{esql-specs}/docs.csv-spec[tag=rlike-result]
|
|
|===
|
|
|
|
Matching special characters (eg. `.`, `*`, `(`...) 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=rlikeEscapingSingleQuotes]
|
|
----
|
|
|
|
To reduce the overhead of escaping, we suggest using triple quotes strings `"""`
|
|
|
|
[source.merge.styled,esql]
|
|
----
|
|
include::{esql-specs}/string.csv-spec[tag=rlikeEscapingTripleQuotes]
|
|
----
|
|
// end::body[]
|