Regex Mark Modifier
Wrap any regex matches in <mark> tags to highlight them on the page.
description: This cat video is the okayest thing ever.
{{ description | regex_mark('cat video|thing') }}
{{ description | regex_mark('video', 'class:highlight') }}
{!! Statamic::modify($description)->regexMark('cat video|thing') !!}
{!! Statamic::modify($description)->regexMark(['video', 'class:highlight']) !!}
This <mark>cat video</mark> is the okayest <mark>thing</mark> ever.
This cat <mark class="highlight">video</mark> is the okayest thing ever.
Hot Tip!
This modifier expects HTML input. Escape plain text containing less-than or greater-than symbols before matching: {{ plain_text | entities | regex_mark('pattern') }}.