1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00
Files
gohugoio-hugo/content/functions/replacere.md
Bjørn Erik Pedersen ec4e6f9df2 Squashed 'docs/' content from commit f887bd7b
git-subtree-dir: docs
git-subtree-split: f887bd7b4e3e7c7e76cd63951e5b0d37d8fe0ac7
2017-08-10 17:18:22 +02:00

1.1 KiB

title, description, godocref, date, publishdate, lastmod, categories, menu, signature, workson, hugoversion, relatedfuncs, deprecated, aliases
title description godocref date publishdate lastmod categories menu signature workson hugoversion relatedfuncs deprecated aliases
replaceRE Replaces all occurrences of a regular expression with the replacement pattern. 2017-02-01 2017-02-01 2017-04-30
functions
docs
parent
functions
replaceRE PATTERN REPLACEMENT INPUT
false
{{ replaceRE "^https?://([^/]+).*" "$1" "http://gohugo.io/docs" }}` → "gohugo.io"
{{ "http://gohugo.io/docs" | replaceRE "^https?://([^/]+).*" "$1" }}` → "gohugo.io"

{{% note %}} Hugo uses Golang's Regular Expression package, 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.

If you are just learning RegEx, or at least Golang's flavor, you can practice pattern matching in the browser at https://regex101.com/. {{% /note %}}