Boost logo

Boost Users :

Subject: [Boost-users] [Q] regular expressions change the 'substitue with' value
From: V S P (toreason_at_[hidden])
Date: 2009-06-26 17:34:49


Looking for some help with how to use regular expression library

I have

a string

"!1!"

I am replacing it with

"\temp\i\otrq92rq40100__db1003.xls"

( a windows path to a file)

This is how I am doing it

            std::string repl=subst_designator+
              boost::lexical_cast<std::string>(counter)+
              subst_designator;

              boost::algorithm::replace_all_regex(new_arg,
                  boost::regex(repl),*res_it);

Where:

subst_designator = '!'
counter = 1
new_arg = "!1!"
*res_it="\temp\i\otrq92rq40100__db1003.xls"

after the above code,
the new_arg contains a strange string that appears to have back slashes
removed and the first
\t replaced with something like a 'tab'
new_arg=" empiotrq92rq40100__db1003.xls"

I am thinking that this is wrong, because the regular expression should
copy without modifications the value of *res_it into the new_arg

I am using 1.38 on windows with VS9.

My question is , how can make it so the string in *res_it substitutes
!1!

thank you in advance,
Vlad

-- 
Vlad P
author of C++  ORM  http://github.com/vladp/CppOrm/tree/master
-- 
http://www.fastmail.fm - IMAP accessible web-mail

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net