Image

Imageiwr wrote in Imagecpp

boost regex

I'd appreciate any idea regarding the following "find-and-replace" functionality: I need a regular expression that would substitute every number, followed by some separator, with another number. There exists a function [int f(int)] converting input numbers into output ones.


For instance, given the input:
1,first,22,twenty two
1,2,3,kuku,5
some more text,5

The output should be:
7,first,33,twenty two
7,12,13,kuku,10
some more text,10

If it's impossible to accomplish this "at once", i.e. just by calling regex_replace(), then what would be the best way to do this, using boost regex?

Thanks in advance!