Boost logo

Boost Users :

From: david v (danova_fr_at_[hidden])
Date: 2006-08-25 05:16:50


Hello,
Is it possible to reverse a regex. In my example below i'm trying to match
the word "hope " and its reverse "epoh". Obviously i could build up a regex
such as (hope|epoh) but i was wondering if there is a member in libboost
that implements that function directly ?

string re = "hope";
boost::regex *regex = new boost::regex(re,boost::regbase::icase);

std::string in = "hope is forward and epoh is reversed";
boost::smatch match;
std::string::const_iterator start = in.begin();
std::string::const_iterator end = in.end();

  while (boost::regex_search(start,end,match,re,boost::match_extra))
      {
        cout << "Match:" << match[0] ;
     }

Thanks,

david


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