Hello, As per PCRE /m modifier $ will match the pattern before any newline. However boost_regex gives back matches before formfeed(\x0c) & CarriagReturn(\x0d) Same is observed for ^ i.e match after newline. Please could anybody let me know what is the right pcre behaviour? I have attached the example for demonstration of the case, using boost_regex Regards, Chandan --------------------------------- Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. #include <iostream> #include <string> #include "/home/ChandanNilange/work/boost/boost_1_34_0/boost/regex.hpp" // Boost.Regex lib using namespace std; int main( ) { std::string s,sre; //regular expression sre="\x30$"; //Matching string s="\x01\x30\x02\x31\x03\x32\x04\x33\x05\x34\x06\x35\x07\x36\x08\x37\x09\x30\x0a\x39\x0b\x30\x0c\x30\x0d\x3c\x0e\x3d\x0f"; boost::regex re; re.assign(sre, boost::regex_constants::perl); std::string::const_iterator start, end; start = s.begin(); end = s.end(); boost::sregex_iterator it(start, end, re); boost::sregex_iterator it_end; for( ; it != it_end; it++) { cout << "Found Pattern:start:" << std::string((*it)[0].first, (*it)[0].second) << ":end:\n" << "Pattern starts at :" << (*it)[0].first - s.begin() << "\nPattern ends at: " << ((*it)[0].second - 1) - s.begin() << "\nPattern length:" << (*it)[0].length() << endl; } } /************************** Results: Found Pattern:start:0:end: Pattern starts at :17 Pattern ends at: 17 Pattern length:1 Found Pattern:start:0:end: Pattern starts at :21 Pattern ends at: 21 Pattern length:1 Found Pattern:start:0:end: Pattern starts at :23 Pattern ends at: 23 Pattern length:1 ****************************/