
Jeff wrote:
Dear Regex Users:
I'd like to know if it is possible to check multiple expressions and specify multiple patters within a single regex_replace statement. For example, I want to replace .html extensions with .php and replace .gif with the .srf extension
Match: http://localhost/index.gif replace with: http://localhost/index.srf
Match: http://localhost/index.html replace with: http://localhost/index.php
Can this be done within a single regex_replace statement? Although this does not work, it demonstrates what I am trying to achieve:
Yep, use "(.gif)|(.html)" as the expression and "(?1.srf:.php)" as the format string along with the match_flag format_all when calling regex_replace. The ?1 is a conditional replacement: see http://svn.boost.org/svn/boost/trunk/libs/regex/doc/html/boost_regex/format/... HTH, John.