rlike.asciidoc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. [discete]
  2. [[esql-rlike-operator]]
  3. ==== `RLIKE`
  4. // tag::body[]
  5. Use `RLIKE` to filter data based on string patterns using using
  6. <<regexp-syntax,regular expressions>>. `RLIKE` usually acts on a field placed on
  7. the left-hand side of the operator, but it can also act on a constant (literal)
  8. expression. The right-hand side of the operator represents the pattern.
  9. include::./types/like.asciidoc[]
  10. [source.merge.styled,esql]
  11. ----
  12. include::{esql-specs}/docs.csv-spec[tag=rlike]
  13. ----
  14. [%header.monospaced.styled,format=dsv,separator=|]
  15. |===
  16. include::{esql-specs}/docs.csv-spec[tag=rlike-result]
  17. |===
  18. Matching special characters (eg. `.`, `*`, `(`...) will require escaping.
  19. The escape character is backslash `\`. Since also backslash is a special character in string literals,
  20. it will require further escaping.
  21. [source.merge.styled,esql]
  22. ----
  23. include::{esql-specs}/string.csv-spec[tag=rlikeEscapingSingleQuotes]
  24. ----
  25. To reduce the overhead of escaping, we suggest using triple quotes strings `"""`
  26. [source.merge.styled,esql]
  27. ----
  28. include::{esql-specs}/string.csv-spec[tag=rlikeEscapingTripleQuotes]
  29. ----
  30. // end::body[]