There are some problems with Stefan's code, but the basic premise is correct; you can't do this replacement in a single stage using regexes. Here's another approach:I'm assuming the dynamic data is always surrounded by single quotes and angle brackets. If that isn't the case, you'll need some other way to identify it.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com