Boost logo

Boost :

From: Edward Diener (eddielee_at_[hidden])
Date: 2003-05-05 17:47:15


Use regex_grep to find matches and then regex_format in the Predicate
function to change each match to another value.

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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk