1//===----------------------------------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9// <regex>
10
11// template <class charT, class traits = regex_traits<charT>> class basic_regex;
12
13// basic_regex& assign(const charT* ptr, size_t len, flag_type f);
14
15#include <regex>
16#include <cassert>
17#include "test_macros.h"
18
19int main(int, char**)
20{
21 std::regex r0;
22 r0.assign("(a([bc]))", 9);
23 assert(r0.flags() == std::regex::ECMAScript);
24 assert(r0.mark_count() == 2);
25
26 std::regex r1;
27 r1.assign(p: "(a([bc]))", len: 9, flags: std::regex::ECMAScript);
28 assert(r1.flags() == std::regex::ECMAScript);
29 assert(r1.mark_count() == 2);
30
31 std::regex r2;
32 r2.assign(p: "(a([bc]))", len: 9, flags: std::regex::extended);
33 assert(r2.flags() == std::regex::extended);
34 assert(r2.mark_count() == 2);
35
36 return 0;
37}
38

source code of libcxx/test/std/re/re.regex/re.regex.assign/assign_ptr_size_flag.pass.cpp