Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -335,20 +335,6 @@ date_string:keyword | date:date
// end::dateParse-result[]
;

docsReplace
//tag::replaceString[]
ROW str = "Hello World"
| EVAL str = REPLACE(str, "World", "Universe")
| KEEP str
// end::replaceString[]
;

//tag::replaceString-result[]
str:keyword
Hello Universe
// end::replaceString-result[]
;

docsCase
// tag::case[]
FROM employees
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,33 @@ first_name:keyword | result:keyword
Alejandro | null
;

docsReplaceText
//tag::replaceString[]
ROW str = "Hello World"
| EVAL str = REPLACE(str, "World", "Universe")
// end::replaceString[]
;

//tag::replaceString-result[]
str:keyword
Hello Universe
// end::replaceString-result[]
;

docsReplaceRegex
//tag::replaceRegex[]
ROW str = "Hello World"
| EVAL str = REPLACE(str, "\\s+", "")
// end::replaceRegex[]
;

//tag::replaceRegex-result[]
str:keyword
HelloWorld
// end::replaceRegex-result[]
;


left
// tag::left[]
FROM employees
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ public class Replace extends EsqlScalarFunction {
description = """
The function substitutes in the string `str` any match of the regular expression `regex`
with the replacement string `newStr`.""",
examples = @Example(
file = "docs",
tag = "replaceString",
description = "This example replaces any occurrence of the word \"World\" with the word \"Universe\":"
)
examples = {
@Example(
file = "string",
tag = "replaceString",
description = "This example replaces any occurrence of the word \"World\" with the word \"Universe\":"
),
@Example(
file = "string",
tag = "replaceRegex",
description = "This example removes all spaces:"
)
}
)
public Replace(
Source source,
Expand Down