Date: 2001-07-26 07:30:54
--- In boost_at_y..., John Maddock <John_Maddock_at_c...> wrote:
> > I've been toying around with an alternate, more concise
> >regular expression operations. Perl is a personal favorite for
> >manipulation, so I've partially mimicked its syntax as an add-on
> >regex. I rarely find that I require more than these simple
> >and sed-like replace).
> Doug, I think this is beginning to grow on me a little - I hadn't
> of using operator overloading to simulate the /expression/format/
> syntax, I would be interested if there are any perl guru's around
> what they think.
> BTW you could extend the operator overloading a little to handle
> arguments (as well as precompileed regex's), I wonder if it's
> to overload operator=~ or failing that a binary operator~, or
> how about operator>> for the string part:
> boost success = mystring >> myregex
> std::string s = mystring >> myregex/myformat
> I'm not sure if this is better or worse though...
> - John Maddock
I thought about trying to mimic some of the syntax exactly, i.e.,
result = (str =~ s/str/fmt/g);
but unfortunately we can't overload operator= for
std::basic_String<Char, Traits>, so it isn't going to happen.
The >> operator approach is reasonable. It seems to read as: "feed
mystring into regex" and "feed mystring into regex and replace with
myformat", respectively. I can live with that.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk