github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/job-specification/hcl2/functions/string/replace.mdx (about) 1 --- 2 layout: docs 3 page_title: replace - Functions - Configuration Language 4 sidebar_title: replace 5 description: |- 6 The replace function searches a given string for another given substring, 7 and replaces all occurrences with a given replacement string. 8 --- 9 10 # `replace` Function 11 12 `replace` searches a given string for another given substring, and replaces 13 each occurrence with a given replacement string. 14 15 ```hcl 16 replace(string, substring, replacement) 17 ``` 18 19 ## Examples 20 21 ```shell-session 22 > replace("1 + 2 + 3", "+", "-") 23 1 - 2 - 3 24 25 > replace("hello world", "world", "everybody") 26 hello everybody 27 ``` 28 29 ## Related Functions 30 31 - [`regex_replace`](/docs/job-specification/hcl2/functions/string/regex_replace) searches a given string for another given substring, 32 and replaces each occurrence with a given replacement string.