Boost logo

Boost Users :

From: Yutaka Emura yutaka_at_[hidden])
Date: 2002-12-24 00:51:08


Hi,
I am using RegEx in Boost v1.29.0.
(?= ) and (?! ) expressions do not seem to work at a certain
condition.

In the following example, "(?=a)b" should match "b" in "xyzabcdefg",
but does not.

Similarly, "(?!a)b" should not match "b" in "xyzabcdefg" but it does.

Can please let me know what is wrong? Thank you for your reply in
advance.

Yutaka Emura

---------

boost::regex expression;
boost::match_results<std::string::const_iterator> subexp;

expression.assign("(?=a)b", boost::regbase::perl);
if (boost::regex_search((std::string::const_iterator)"xyzabcdefg",
(std::string::const_iterator)"xyzabcdefg" + 10, subexp, expression,
boost::match_default)) {
{
        // should go here
}
else {
        // goes here
}

expression.assign("(!=a)b", boost::regbase::perl);
if (boost::regex_search((std::string::const_iterator)"xyzabcdefg",
(std::string::const_iterator)"xyzabcdefg" + 10, subexp, expression,
boost::match_default)) {
{
        // goes here
}
else {
        // should go here
}


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