Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
\A(?:^.*$\n){1}\K^.*$
/
gm
Input 1
New
{{- .Scratch.Set "pagesIndex" slice -}} {{- range where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}} {{- $contentRE := replaceRE "(<pre.*>(.|\n)*?</pre>)|(<code.*>(.|\n)*?</code>)|(<h[2-4].*>(.|\n)*?</h[2-4]>)|(<[^>]*>)|(\\n)|(\\t)" "" (.Content | htmlUnescape) -}} {{- $pageData := (dict "title" .Title "href" .RelPermalink "content" $contentRE) -}} {{- $.Scratch.Add "pagesIndex" $pageData -}} {{- end -}} {{- .Scratch.Get "pagesIndex" | jsonify -}}
Substitution
{{- .Scratch.Set "pagesIndex" slice -}} {{- range where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}} {{- $contentRE := replaceRE "(<pre.*>(.|\n)*?</pre>)|(<code.*>(.|\n)*?</code>)|(<h[2-4].*>(.|\n)*?</h[2-4]>)|(<[^>]*>)|(\\n)|(\\t)" "" (.Content | htmlUnescape) -}} {{- $pageData := (dict "title" .Title "href" .RelPermalink "content" $contentRE) -}} {{- $.Scratch.Add "pagesIndex" $pageData -}} {{- end -}} {{- .Scratch.Get "pagesIndex" | jsonify -}}