diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2020-05-06 22:17:19 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2020-05-06 22:17:19 -0400 |
| commit | f607561e026d28c618a8b11d149fb99453c5d46a (patch) | |
| tree | 8eeec770e15109b1287ded995be1b58d549f5d94 /docs-src/content/functions/regexp.yml | |
| parent | cdc84127a939743d9f6bf879c52a38c6d279ad6d (diff) | |
Add function regexp.QuoteMeta
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs-src/content/functions/regexp.yml')
| -rw-r--r-- | docs-src/content/functions/regexp.yml | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs-src/content/functions/regexp.yml b/docs-src/content/functions/regexp.yml index db46f797..f1a50626 100644 --- a/docs-src/content/functions/regexp.yml +++ b/docs-src/content/functions/regexp.yml @@ -72,6 +72,21 @@ funcs: - | $ gomplate -i '{{ if (.Env.USER | regexp.Match `^h`) }}username ({{.Env.USER}}) starts with h!{{end}}' username (hairyhenderson) starts with h! + - name: regexp.QuoteMeta + description: | + Escapes all regular expression metacharacters in the input. The returned string is a regular expression matching the literal text. + + This function provides the same behaviour as Go's + [`regexp.QuoteMeta`](https://golang.org/pkg/regexp/#Regexp.QuoteMeta) function. + pipeline: true + arguments: + - name: input + required: true + description: The input to escape + examples: + - | + $ gomplate -i '{{ `{hello}` | regexp.QuoteMeta }}' + \{hello\} - name: regexp.Replace description: | Replaces matches of a regular expression with the replacement string. |
