replace.asciidoc 786 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. [discrete]
  2. [[esql-replace]]
  3. === `REPLACE`
  4. *Syntax*
  5. [.text-center]
  6. image::esql/functions/signature/replace.svg[Embedded,opts=inline]
  7. *Parameters*
  8. `str`::
  9. String expression.
  10. `regex`::
  11. Regular expression.
  12. `newStr`::
  13. Replacement string.
  14. *Description*
  15. The function substitutes in the string `str` any match of the regular expression
  16. `regex` with the replacement string `newStr`.
  17. If any of the arguments is `null`, the result is `null`.
  18. include::types/replace.asciidoc[]
  19. *Example*
  20. This example replaces any occurrence of the word "World" with the word
  21. "Universe":
  22. [source.merge.styled,esql]
  23. ----
  24. include::{esql-specs}/docs.csv-spec[tag=replaceString]
  25. ----
  26. [%header.monospaced.styled,format=dsv,separator=|]
  27. |===
  28. include::{esql-specs}/docs.csv-spec[tag=replaceString-result]
  29. |===