Idiomatic way to replace all occurrences of a pattern in a string with Regex


Lets say that I have a string like this: %78 = OpCompositeInsert %v4float %77 %17 0
and I want to add to add w suffix to every name beginning with ‘%’.

What is the most idiomatic/elegant way to do it using llvm::Regex? Or is there a better tool to do so?