Boost logo

Boost Users :

Subject: Re: [Boost-users] [regex] Boost.Regex + ICU vs. standalone ICU
From: AJG (plus.ajg_at_[hidden])
Date: 2010-09-26 16:30:12


John Maddock <boost.regex <at> virgin.net> writes:
> The new stuff in Perl-5.10 and supported in Boost.Regex are:
>
> Named sub-expressions:
>
http://www.boost.org/doc/libs/1_44_0/libs/regex/doc/html/boost_regex/syntax/perl
_syntax.html#boost_regex.syntax.perl_syntax.named_subexpressions
>
> Branch resets:
>
http://www.boost.org/doc/libs/1_44_0/libs/regex/doc/html/boost_regex/syntax/perl
_syntax.html#boost_regex.syntax.perl_syntax.branch_reset
>
> Recursion:
>
http://www.boost.org/doc/libs/1_44_0/libs/regex/doc/html/boost_regex/syntax/perl
_syntax.html#boost_regex.syntax.perl_syntax.recursive_expressions
>
> Conditional on recursion or subexpression match:
>
http://www.boost.org/doc/libs/1_44_0/libs/regex/doc/html/boost_regex/syntax/perl
_syntax.html#boost_regex.syntax.perl_syntax.conditional_expressions
>
> The (*OPERATOR) syntax introduced in Perl-5.10 is not currently supported.
>
> HTH, John.

That's fantastic, thank you. I have an unrelated Boost.Regex question: how
expensive are basic_regex objects to copy? Say, relative to constructing (and
thus reparsing) from a string pattern, anew?

The reason I ask is because I have a variant type with several value types,
including a regex type. I was wondering whether it makes more sense to store the
regex pattern in that variant as a string, and to construct the actual
basic_regex from that string every time I need to operate on it, or to store it
as a basic_regex and hope that copies are not too expensive. One other
alternative is to store the regex on the heap using a smart pointer, but I'd
rather keep value semantics so long as performance isn't an issue.

(Oh, incidentally, does Boost.Regex have support for Boost.Serialization? Right
now what I do is serialize it [the pattern] as an std::string -- is that the
recommended approach?)

Thanks!


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