hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

replace.md (709B)

    1 ---
    2 title: replace
    3 description: Replaces all occurrences of the search string with the replacement string.
    4 date: 2017-02-01
    5 publishdate: 2017-02-01
    6 lastmod: 2020-09-07
    7 categories: [functions]
    8 menu:
    9   docs:
   10     parent: "functions"
   11 keywords: []
   12 signature: ["strings.Replace INPUT OLD NEW [LIMIT]", "replace INPUT OLD NEW [LIMIT]"]
   13 workson: []
   14 hugoversion:
   15 relatedfuncs: []
   16 deprecated: false
   17 aliases: []
   18 ---
   19 
   20 Replace returns a copy of `INPUT` with all occurrences of `OLD` replaced with `NEW`.
   21 The number of replacements can be limited with an optional `LIMIT` parameter.
   22 
   23 ```
   24 `{{ replace "Batman and Robin" "Robin" "Catwoman" }}`
   25 → "Batman and Catwoman"
   26 
   27 {{ replace "aabbaabb" "a" "z" 2 }} → "zzbbaabb"
   28 ```