Boost logo

Boost Users :

Subject: [Boost-users] Boost Regex - Alternation documentation example
From: Nick (nospam_at_[hidden])
Date: 2017-07-15 13:12:10


According to the Boost Regex documentation for Alternation
(http://www.boost.org/doc/libs/1_64_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html#boost_regex.syntax.perl_syntax.alternation)

Quoting a piece of the documentation:

-----

|abc is not a valid expression, but

(?:)|abc is and is equivalent, also the expression:

(?:abc)?? has exactly the same effect.

-----

Is the last expression:

   (?:abc)??

correct? Why does it need two '?' operators instead of only one?

If I try this expression with the input "abc" the Boost engine does not
match "abc" as I'd have expected. However the expression:

   (?:abc)?

matches as expected.

Nick


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