diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-10-21 10:22:28 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-10-21 10:22:28 +0200 |
commit | 27aef3f1fbf657137e825f30bb50dda393618a6f (patch) | |
tree | bcc05254f2977e3cc75d7dcb4cbaac5625cf7a1b /docs/content/en/functions/replacere.md | |
parent | 39121de4d991bdcf5f202da4d8d81a8ac6c149fc (diff) | |
parent | b9bd35d72e14932fb6588ff62b90cddef0a060fc (diff) |
Merge commit 'b9bd35d72e14932fb6588ff62b90cddef0a060fc' as 'docs'
Diffstat (limited to 'docs/content/en/functions/replacere.md')
-rw-r--r-- | docs/content/en/functions/replacere.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/content/en/functions/replacere.md b/docs/content/en/functions/replacere.md new file mode 100644 index 000000000..9c2778b5f --- /dev/null +++ b/docs/content/en/functions/replacere.md @@ -0,0 +1,31 @@ +--- +title: replaceRE +# linktitle: replaceRE +description: Replaces all occurrences of a regular expression with the replacement pattern. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-04-30 +categories: [functions] +menu: + docs: + parent: "functions" +keywords: [regex] +signature: ["replaceRE PATTERN REPLACEMENT INPUT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +``` +{{ replaceRE "^https?://([^/]+).*" "$1" "http://gohugo.io/docs" }}` → "gohugo.io" +{{ "http://gohugo.io/docs" | replaceRE "^https?://([^/]+).*" "$1" }}` → "gohugo.io" +``` + +{{% note %}} +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). + +If you are just learning RegEx, or at least Go's flavor, you can practice pattern matching in the browser at <https://regex101.com/>. +{{% /note %}} |