mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-10-06 10:04:07 -04:00
26 lines
639 B
Markdown
26 lines
639 B
Markdown
---
|
|
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-02-01
|
|
categories: [functions]
|
|
tags: [regex]
|
|
ns:
|
|
signature: ["replaceRE PATTERN REPLACEMENT INPUT"]
|
|
workson: []
|
|
hugoversion:
|
|
relatedfuncs: []
|
|
deprecated: false
|
|
aliases: []
|
|
---
|
|
|
|
Replaces all occurrences of a regular expression with the replacement pattern.
|
|
|
|
```golang
|
|
{{ replaceRE "^https?://([^/]+).*" "$1" "http://gohugo.io/docs" }}` → "gohugo.io"
|
|
{{ "http://gohugo.io/docs" | replaceRE "^https?://([^/]+).*" "$1" }}` → "gohugo.io"
|
|
```
|