Is it possible to use regular expressions within custom sentences?

Hello! I’m working a few pet projects that all require using regular expressions within custom sentences. A simple example of what I’m trying to do is this:

add {{item}} to my shopping list

{{item}} could be an expansion rule in my _common.yaml that is defined as the following:

item: "{%regex_search([\w ]*)%}"

Is something like this possible with custom sentences? I’ve been scouring the Jinja and HA docs, and it doesn’t seem like the case.

Also, this is my first post, I apologize if formatting is funky.

This is possible with a custom component, I explain how to use it in this topic.

1 Like

Ever found a native solution?