Performs a regular expression search and replace.
@{ text | replace (regex, replace) }
"/pattern/"
.$1
to $n
as described here.Note that you will have to use double backslashes
\\
to escape reserved characters in regex patterns.
The following example will first parse all Markdown in a variable called text
and then wrap everything enclosed with double curly brackets in a <div>
:
@{ text |
markdown |
replace (
'/\\{\\{(.*?)\\}\\}/is',
'<div class="wrapper">$1</div>'
)
}