I have a stash list of different plans that I need to break based on whether the word light
is in the title or not.
So here is what I'd like:
- One list of plans whose title contains the word light. If it doesn't contain light then I don't want it.
- Complete opposite to above. List of plans without light in the title.
I believe this possible using the match
and against
params in stash but I can't work out what the regex would be.
Code:
{exp:stash:set_list
name="digismart_plans"
save="yes"
scope="site"
parse_tags="yes"
}
{exp:channel:entries
channel="plan_digismart"
disable="categories|category_fields|member_data|pagination|trackbacks"
dynamic="no"
}
{stash:plan_title}{title}{/stash:plan_title}
{stash:plan_entry_id}{entry_id}{/stash:plan_entry_id}
{/exp:channel:entries}
{/exp:stash:set_list}
Then later in the template
{exp:stash:get_list
name="digismart_plans"
parse_vars="yes"
parse_tags="yes"
match="[#Light#]"
against="plan_title"
}
{plan_title}
{/exp:stash:get_list}
Not sure on the regex required for not Light. Would be as simple as match="{#!Light#]"
?
against=""
parameter value.parse_tags="yes"
orparse_vars="yes"
when you get the list. Also, be sure to enclose your regex pattern with hashes, e.g.#(?m)^((?!\b(l|L)ight\b).)*$#