1 2 // Copyright 2018 Peter Dimov. 3 // 4 // Distributed under the Boost Software License, Version 1.0. 5 // 6 // See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt 8 9 #include <boost/regex.hpp> 10 #include <boost/core/lightweight_test.hpp> 11 main()12int main() 13 { 14 boost::regex rx( "(\\d+)-+(\\d+)-+(\\d+)" ); 15 16 std::string s = boost::regex_replace( std::string( "+1--2--3+" ), rx, "$1$2$3" ); 17 18 BOOST_TEST_EQ( s, "+123+" ); 19 20 return boost::report_errors(); 21 } 22