Boost logo

Boost :

From: Edward Diener (eddielee_at_[hidden])
Date: 2003-05-06 16:19:15

Thaddeus L. Olczyk wrote:
> On Mon, 05 May 2003 22:18:57 -0400, Edward Diener
> <eddielee_at_[hidden]> wrote:
>> Thaddeus L. Olczyk wrote:
>>> On Mon, 05 May 2003 18:47:15 -0400, Edward Diener
>>> <eddielee_at_[hidden]> wrote:
>>>> Use regex_grep to find matches and then regex_format in the
>>>> Predicate function to change each match to another value.
>>> Excuse me, but I see no place in the documentation where it
>>> describes
>>> a format string which says something like " take all of the string
>>> sans subexpression and set the subexpressions to xxxx".
>>> Without that type of format string I do not see any way that
>>> regex_format can do that.
>> OK, I see now what you are trying to do. What about running a second
>> regex_grep, after finding your initial match for the entire string
>> in which you are searching, in which your regex string is:
>> "\\$NAME|\\$ADDRESS|\\$EMAIL"
>> Then when a match is found in your regex_grep, use regex_format to
>> change to the appropriate substitution by testing, in the regex_grep
>> predicate function, for which one of the matches has been found.
>>>> Thaddeus L. Olczyk wrote:
>>>>> I've been searching the documentation for way to do regular
>>>>> expression substitition of groups.
>>>>> For example: Given the regex;
>>>>> "My[ ]+name[ ]+is[ ]+($NAME)[.]+
>>>>> I[ ]+live[ ]+at[ ]+($ADDRESS)[.]+
>>>>> My[ ]+email[ ]+address[ ]+is[ ]+($EMAIL)"
>>>>> I search some string for a match, find this:
>>>>> "My name is $NAME . I live at $ADDRESS.
>>>>> I am an acountant. My email address is $EMAIL"
>>>>> and want to substitute
>>>>> "Bob Smith" for $NAME
>>>>> "1600 Pensylvania Ave." for $ADDRESS
>>>>> "bob_at_[hidden]" for $EMAIL.
> No. That won't work.

Why ?

Boost list run by bdawes at, gregod at, cpdaniel at, john at