
Thanks for Your reply im closer but ther's a diffrent if i do as You say like this std::string stmp = "PORT (127,0,0,1,6,56)\r"; boost::regex regex_ip(".+\\(?([0-9]{1,}),([0-9]{1,}),([0-9]{1,}),([0-9]{1,}),([0-9]{1,}),([0-9]{1,})\\)?.*"); std::string sip = boost::regex_replace(stmp, regex_ip, "$1.$2.$3.$4", boost::format_all); the output is 7.0.0.1 but if i have the std::string stmp = "PORT (127,0,0,1,6,56)\r"; boost::regex regex_ip(".+\\(([0-9]{1,}),([0-9]{1,}),([0-9]{1,}),([0-9]{1,}),([0-9]{1,}),([0-9]{1,})\\).*"); std::string sip = boost::regex_replace(stmp, regex_ip, "$1.$2.$3.$4", boost::format_all); the output is 127.0.0.1
there is something i miss
Yep, the leading ".+" is greedy and is gobbling up more than you want it to. Suggest you either make it non-greedy, or more precise. John.