1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: no-exceptions
12 // template <class OutputIterator, class BidirectionalIterator,
13 // class traits, class charT, class ST, class SA>
15 // regex_replace(OutputIterator out,
16 // BidirectionalIterator first, BidirectionalIterator last,
17 // const basic_regex<charT, traits>& e,
18 // const basic_string<charT, ST, SA>& fmt,
19 // regex_constants::match_flag_type flags =
20 // regex_constants::match_default);
25 #include "test_macros.h"
30 std::regex
re("a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaa");
31 const char s
[] = "aaaaaaaaaaaaaaaaaaaa";
32 std::string r
= std::regex_replace(s
, re
, "123-&", std::regex_constants::format_sed
);
34 assert(r
== "123-aaaaaaaaaaaaaaaaaaaa");
35 } catch (const std::regex_error
&e
) {
36 assert(e
.code() == std::regex_constants::error_complexity
);