hugo/docs/content/en/functions/replace.md
Cameron Moore 183e862607 docs: Update replace func
Updates for #7602
2020-09-07 22:45:14 +02:00

720 B

title description godocref date publishdate lastmod categories menu keywords signature workson hugoversion relatedfuncs deprecated aliases
replace Replaces all occurrences of the search string with the replacement string. 2017-02-01 2017-02-01 2020-09-07
functions
docs
parent
functions
strings.Replace INPUT OLD NEW [LIMIT]
replace INPUT OLD NEW [LIMIT]
false

Replace returns a copy of INPUT with all occurrences of OLD replaced with NEW. The number of replacements can be limited with an optional LIMIT parameter.

`{{ replace "Batman and Robin" "Robin" "Catwoman" }}`
→ "Batman and Catwoman"

{{ replace "aabbaabb" "a" "z" 2 }} → "zzbbaabb"