Boost logo

Boost Users :

From: llwaeva_at_[hidden]
Date: 2006-07-27 10:24:12


Hi there,
  I am using regex_replace for string replacing. I am working with a
very large string (about 3M) and need to do the following replacment

%R% --> #R#
%A% --> #R1#
%C% --> #R2#

and so on.

I am new to regular express and regex. After having read the document, I
know how regex works, but still not sure if regex_replace meet my
demand

1) I invoke regex_replace several times to replace difference patterns.
For a large input string, the operation is very slow. Can I call
regex_replace once to do the several replacments. i.e. calling
  regex_replace( output, begin, end, "%R ,%A ,%C", "#R#, #R1#, #R2#", match_default);
for replacing
%R% with #R#
%A% with #R1#
%C% with #R2#

2) According to the document, the output fashion depends on the match_flag_type,
for my case, I hope the output string, including both matched and
nonmatched part, replace the whole input string. e.g.

SourceStr = "xxxx%R%yyy%A%zzz%C%"
Apply regex_replace( output_string, SourceStr.begin, SourceStr.end, ... )
We have , output_string = "xxxx#R#yyy#R1#zzz#R2#"
rather than #R#, #R1# and #R2#

Any reply will be highly appreciated.


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