XF 2.2 regex capturing groups in template modification

Earl

Well-known member
is it possible? I know I can access matches with $0, $1, $2
but is it possible to use an expression like this:
#.(something1).(something2)#
and use capturing groups so I can add new things new thing 1 something1 blahblah new thing2 something2


This is exactly what I wanna do:

I have this template: (actually it's not even a template. its another template mod comming from another add-on. I'm adding 2nd level template modification to it) so here it ends before my template mod:
HTML:
<xf:macro name="forum" arg-activeTab="">
    <a href="{{ link('th-all-threads/trending') }}"
       class="tabs-tab {{$activeTab == 'trending' ? 'is-active' : '' }}">
        {{ phrase('thfilters_trending') }}
    </a>
    <a href="{{ link('th-all-threads/latest') }}"
       class="tabs-tab {{$activeTab == 'latest' ? 'is-active' : '' }}">
        {{ phrase('thfilters_latest') }}
    </a>
    <a href="{{ link('th-all-threads/newest') }}"
       class="tabs-tab {{$activeTab == 'newest' ? 'is-active' : '' }}">
        {{ phrase('thfilters_newest') }}
    </a>
    <a href="{{ link('forums/-/list') }}"
       class="tabs-tab {{$activeTab == 'forum_list' ? 'is-active' : '' }}">
        {{ phrase('forum_list') }}
    </a>
</xf:macro>

I need to add font awesome icons before each of those {{ phrase (...)}} lines
{{ phrase('thfilters_trending') }}, {{ phrase('thfilters_latest') }}, {{ phrase('thfilters_newest') }}, {{ phrase('forum_list') }}


So I can capture them with regular expression capture groups and add icon elements like this

HTML:
<xf:macro name="forum" arg-activeTab="">
    <a href="{{ link('th-all-threads/trending') }}"
       class="tabs-tab {{$activeTab == 'trending' ? 'is-active' : '' }}">
        property('earlMainTab1Icon')
        $cg1
    </a>
    <a href="{{ link('th-all-threads/latest') }}"
       class="tabs-tab {{$activeTab == 'latest' ? 'is-active' : '' }}">
        property('earlMainTab2Icon')
        $cg2
    </a>
    <a href="{{ link('th-all-threads/newest') }}"
       class="tabs-tab {{$activeTab == 'newest' ? 'is-active' : '' }}">
        property('earlMainTab3Icon')
        $cg3
    </a>
    <a href="{{ link('forums/-/list') }}"
       class="tabs-tab {{$activeTab == 'forum_list' ? 'is-active' : '' }}">
        property('earlMainTab4Icon')
        $cg4
    </a>
</xf:macro>

Is this doable?
 
Top Bottom