github.com/rabbouni145/gg@v0.47.1/docs/content/en/functions/replacere.md (about) 1 --- 2 title: replaceRE 3 # linktitle: replaceRE 4 description: Replaces all occurrences of a regular expression with the replacement pattern. 5 godocref: 6 date: 2017-02-01 7 publishdate: 2017-02-01 8 lastmod: 2017-04-30 9 categories: [functions] 10 menu: 11 docs: 12 parent: "functions" 13 keywords: [regex] 14 signature: ["replaceRE PATTERN REPLACEMENT INPUT"] 15 workson: [] 16 hugoversion: 17 relatedfuncs: [] 18 deprecated: false 19 aliases: [] 20 --- 21 22 ``` 23 {{ replaceRE "^https?://([^/]+).*" "$1" "http://gohugo.io/docs" }}` → "gohugo.io" 24 {{ "http://gohugo.io/docs" | replaceRE "^https?://([^/]+).*" "$1" }}` → "gohugo.io" 25 ``` 26 27 {{% note %}} 28 Hugo uses Go's [Regular Expression package](https://golang.org/pkg/regexp/), which is the same general syntax used by Perl, Python, and other languages but with a few minor differences for those coming from a background in PCRE. For a full syntax listing, see the [GitHub wiki for re2](https://github.com/google/re2/wiki/Syntax). 29 30 If you are just learning RegEx, or at least Go's flavor, you can practice pattern matching in the browser at <https://regex101.com/>. 31 {{% /note %}}