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 //===----------------------------------------------------------------------===//
12 // The regular expression shall not match an empty sequence.
14 #include "test_macros.h"
20 // When match_not_null is on, the regex engine should reject empty matches and
21 // move on to try other solutions.
23 assert(!std::regex_search("a", m
, std::regex("b*"),
24 std::regex_constants::match_not_null
));
25 assert(std::regex_search("aa", m
, std::regex("a*?"),
26 std::regex_constants::match_not_null
));
27 assert(m
[0].length() == 1);
28 assert(!std::regex_search("a", m
, std::regex("b*", std::regex::extended
),
29 std::regex_constants::match_not_null
));
30 assert(!std::regex_search(
32 std::regex("b*", std::regex::extended
| std::regex_constants::nosubs
),
33 std::regex_constants::match_not_null
));
35 assert(!std::regex_match("", m
, std::regex("a*"),
36 std::regex_constants::match_not_null
));
37 assert(!std::regex_match("", m
, std::regex("a*", std::regex::extended
),
38 std::regex_constants::match_not_null
));
39 assert(!std::regex_match(
41 std::regex("a*", std::regex::extended
| std::regex_constants::nosubs
),
42 std::regex_constants::match_not_null
));