c++ - How can you specify carriage return and newline character match when using boost::regex? -
i having problem boost::regex behaviour when comes matching \r , \n characters in string. communicating on serial port modem linux c++ application , receiving following message it ati3\r\nv3.244\r\nok\r\n i know string correct check ascii hex values of each character returned. problem application needs strip out version number specified vx.xyz part of string. end using following boost::regex based code: string str_modem_fw_version_number = ""; string str_regex("ati3\r\nv(\d+[.]\d+)\r\nok\r\n"); boost::regex patt; try { patt.assign(str_regex); boost::cmatch what; if (boost::regex_match(str_reply.c_str(), sc_what, patt)) { str_modem_fw_version_number = string(sc_what[1].first,sc_what[1].second); } } catch (const boost::regex_error& e) { cout << e.what() << endl; } the above not work - can see string correct sure making obvious error cr , nl characters in regex. have tried following not ...