So if I'm following this correctly you are reevaluating each found pattern again even though it might not be needed.
Some regexps can be quite expensive to run. Is there some way to approach it from the other end, to just evaluate and expand the indications that are specified in the description? Or at least not do all this if the description doesn't contain ${ ?