Back to Elasticsearch

Replace

docs/reference/query-languages/esql/_snippets/functions/examples/replace.md

9.4.0490 B
Original Source

% This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.

Examples

This example replaces any occurrence of the word "World" with the word "Universe":

esql
ROW str = "Hello World"
| EVAL str = REPLACE(str, "World", "Universe")
str:keyword
Hello Universe

This example removes all spaces:

esql
ROW str = "Hello World"
| EVAL str = REPLACE(str, "\\\\s+", "")
str:keyword
HelloWorld