I\'ve looked at the regex functions in the POSIX regex library and the PCRE library, but both of them don\'t seem to have a string replacement function. I don\'t want to use
The PCRE library itself does not provide a replace function, but there is a wrapper function available at the PCRE downloads page that accepts perl style =~ s/pattern/replace/
syntax and then uses the PCRE native functions to do a substitute/replace for you. Go to http://www.pcre.org/ then click on the Download link: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, then the Contrib directory. The package/project you want is: pcrs-0.0.3-src.tar.gz
.
Note that I have not used this myself so I cannot testify as to how well it works. It is a fairly small and simple piece of code however, so it may well serve your purpose nicely.