mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-10-17 15:15:53 -04:00
2.0 KiB
2.0 KiB
title | linktitle | description | godocref | date | publishdate | lastmod | categories | tags | ns | signature | workson | hugoversion | relatedfuncs | deprecated | aliases | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
findre | findRE | Returns a list of strings that match the regular expression. | 2017-02-01 | 2017-02-01 | 2017-02-01 |
|
|
false |
Returns a list of strings that match the regular expression. By default all matches will be included. The number of matches can be limitted with an optional third parameter.
The example below returns a list of all second level headers (<h2>
) in the content:
{{ findRE "<h2.*?>(.|\n)*?</h2>" .Content }}
You can limit the number of matches in the list with a third parameter. The following example shows how to limit the returned value to just one match (or none, if there are no matched substrings):
{{ findRE "<h2.*?>(.|\n)*?</h2>" .Content 1 }}
<!-- returns ["<h2 id="#foo">Foo</h2>"] -->