Boost logo

Boost Users :

Subject: [Boost-users] [Regex] This pattern compiles fine for Perl and PCRE but not for Boost Regex
From: David Dawe (DDawe_at_[hidden])
Date: 2010-10-18 13:23:40


Boost Regex fails to compile a regular expression such as "{abc}" with
the error

"Invalid content of repeat range". However, both Perl and PCRE accept
the regular

expression, treating the "{" as a literal character.

 

The PCRE man page at http://www.pcre.org/pcre.txt clearly states:

 

    An opening curly bracket that appears in a position where a
quantifier

    is not allowed, or one that does not match the syntax of a
quantifier,

    is taken as a literal character.

 

The Perl regular expression man page at
http://perldoc.perl.org/perlre.html

is similar, though not quite as clear:

 

    If a curly bracket occurs in any other context, it is treated as a
regular

    character. In particular, the lower bound is not optional.

 

Nevertheless, the behaviour of both PCRE and Perl are the same.

 

I am currently using Boost 1.39, but I have seen no mention of a change
in

this area for more recent versions of Boost Regex.

 

And finally ... my question ...

 

Is there a way in Boost Regex to interpret a "{" as a literal character
in

the above context in a Perl regular expression, while still allowing the

"{n,m}" bounded repeat in places where it is syntactically valid?

 

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