Formatting text with an unknown number of variables

The format text node can replace any variable specified in curly brackets with a wildcard value, this is perfectly fine for hardcoded values, single lines of dialog, or text where the order of the variables never changes but less useful for a large amount of text (e.g. using data tables) or text that might have different variables at a given time (e.g. in a dialog tree).

I know the node itself is hardcoded, which is annoying but understandable. But as I’ve learned through my own attempts, trying to loop through and replace each variable one by one (which would work in something like Python F-strings and C++’s std::format) doesn’t really work. I want to call a single “format text” function where I can just have the individual actors specify their available values. That way I can minimize how much is stored in the actors themselves and keep everything nice and modular (or at least more modular than the alternative).

What I attempted. I got a free, basic regex plugin that lets me extract any specific variables (easy enough), I can then query the actor and obtain the correct values (again easy), but trying to format like that won’t work because the node won’t take the values as pins unless they’re specifically hardcoded to each variable.

The only other post I found mentioning this said removing this restriction requires a C++ wrapper class, which I’m wary about for obvious reasons. So before I get too far into the weeds trying to clean this up, is there any easier solution I’m missing? Anything that would let me format a piece of text without explicitly hardcoded the values?