Firstly, regular expression constants are better be placed outside of component function. Otherwise they get recreated each change event.
Second, is there a purpose of changing value? If we enter the if statement, we will not change the state, so it will affect nothing. And we don't need to return value; in the end, too.
Third, in current configuration there ...
std::string Replace(std::string text,
Why are you passing text by value ? Best practice now is to pass via string_view instead.
Passing a std::function is less efficient than making it a template like all the algorithms and various places in the standard library. If this is just a toy example for the ...
There are a lot easier ways to print your name and age, but I'll assume you know that :)
When you pass non-POD arguments into functions it is usually more efficient to pass them as references, because it means you don't create a copy of them. (POD => Plain Old Data: int, char, etc).
When you pass an argument by reference it can introduce confusion, is ...