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