On Tuesday, 21 June 2016 11:29:48 UTC+3, Ralf Goertz wrote:
> Am Mon, 20 Jun 2016 05:58:28 -0700 (PDT)
> schrieb Öö Tiib <
oot...@hot.ee>:
>
> > Best is to assume that 'boost::regex_replace' and
> > 'std::regex_replace' are totally different functions and those having
> > something in common is purely accidental.
>
> Well, isn't boost the forerunner in implementing new features that later
> become standard? So I would like to think that these to function are
> merely two implementations of the same (standard) thing.
You seem to think that first there is standard and then boost. Actually
it is other way around. Boost was made for to produce candidates of
classes and libraries into C++ standard library. It is quite successful in
that. That does not mean that successful candidate is accepted into
standard library without changes. It seems more common that there
are some changes. Also, Boost tries to be platform-neutral so usually
there will be several platform-specific implementation after something
of it is standardized.
>
> > Issue about escape symbols is always about details of grammar. Regex
> > grammars can be seemingly configured with constants (your posted
> > code goes with defaults).
> >
http://www.cplusplus.com/reference/regex/regex_constants/ There can
> > be (I'm speculating now) some sort of difference. For example that
> > the 'format_default' means slightly different things for 'boost' and
> > 'std'.
>
> Yeah, but so far I have failed to find a standard or boost document that
> mentions explicitely that I have to escape the backslash. The only hint
> given by someone at stackoverflow is that boost does it the perl way and
> in perl we also need to escape '\' in the replacement string.
I have also read gossip that boost had some Perl-like features to that
"ECMAScript" that std::regex is not required to contain but i'm unsure
if it is about those backslashes.
> I only have gcc at hand I don't really know what the standard says. It
> might still be that boost is correctly interpreting the standard and the
> gcc got it wrong. That's my real question. What is the right behaviour
> of that function according to the standard?
Perl is not mentioned anywhere. I see "ECMAScript", "POSIX BRE",
"POSIX ERE", "grep", "egrep" and "awk" mentioned.
>
> > Such differences are no problem but the endless source of work (and so
> > bread) for you. ;-)
>
> Well, for me the are indeed a pain in the ass because I am not paid to
> write code per se but to solve problems. For that I write c++ programs
> and try to stick to the standard.
When you write programs to solve problems then what a function or library is
documented to do is likely less important than what it actually does. These
two things are never exactly same and also both documentation and behavior
will change over time. Also, what problem needs usage of both boost::regex
and std::regex in mix?