1aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant//===----------------------------------------------------------------------===// 2aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// 3aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// The LLVM Compiler Infrastructure 4aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// 5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open 6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// Source Licenses. See LICENSE.TXT for details. 7aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// 8aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant//===----------------------------------------------------------------------===// 9aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant 10b4ed5ca01e2b984687ce560b08c20c28ec3cae98Dan Albert// REQUIRES: locale.cs_CZ.ISO8859-2 11b4ed5ca01e2b984687ce560b08c20c28ec3cae98Dan Albert 12aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// <regex> 13aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant 14aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// template <class BidirectionalIterator, class Allocator, class charT, class traits> 15aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// bool 16aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// regex_match(BidirectionalIterator first, BidirectionalIterator last, 17aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// match_results<BidirectionalIterator, Allocator>& m, 18aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// const basic_regex<charT, traits>& e, 19aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant// regex_constants::match_flag_type flags = regex_constants::match_default); 20aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant 2179578cd14ff1f4579b31ae666e869d19eac97232Eric Fiselier// TODO: investigation needed 2279578cd14ff1f4579b31ae666e869d19eac97232Eric Fiselier// XFAIL: linux-gnu 2379578cd14ff1f4579b31ae666e869d19eac97232Eric Fiselier 24aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant#include <regex> 25aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant#include <cassert> 2683e2c4d877fe2d7793868b1c6a5d9525a7c4d431Marshall Clow#include "test_iterators.h" 27aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant 28eda3fcaaedc2c6a13fce15fbe5fd472b642dc830Ed Schouten#include "platform_support.h" // locale name macros 29eda3fcaaedc2c6a13fce15fbe5fd472b642dc830Ed Schouten 30aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnantint main() 31aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant{ 32aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 33aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 34aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "a"; 35aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("a"))); 36aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 37aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.empty()); 38aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 39aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 40aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 41aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 42aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 43aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+1); 44aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 1); 45aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 46aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == "a"); 47aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 48aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 49aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 50aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "ab"; 51aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("ab"))); 52aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 53aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 54aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 55aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 56aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 57aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 58aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+2); 59aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 2); 60aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 61aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == "ab"); 62aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 63aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 64aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 65aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "ab"; 66aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("ba"))); 67aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 68aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.empty()); 69aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 70aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 71aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 72aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "aab"; 73aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("ab"))); 74aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 75aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 76aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 77aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 78aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "aab"; 79aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("ab"), 80aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::regex_constants::match_continuous)); 81aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 82aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 83aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 84aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 85aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abcd"; 86aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("bc"))); 87aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 88aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 89aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 90aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 91aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abbc"; 92aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("ab*c"))); 93aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 94aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 95aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 96aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 97aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 98aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 99aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+4); 100aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 4); 101aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 102aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 103aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 104aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 105aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 106aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "ababc"; 107aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("(ab)*c"))); 108aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 2); 109aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 110aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 111aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 112aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 113aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 114aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+5); 115aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 5); 116aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 117aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 118aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(1) == 2); 119aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(1) == 2); 120aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(1) == "ab"); 121aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 122aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 123aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 124aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abcdefghijk"; 125aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("cd((e)fg)hi"))); 126aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 127aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 128aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 129aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 130aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abc"; 131aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("^abc"))); 132aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 133aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 134aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 135aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 136aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 137aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 138aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 139aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 140aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 141aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 142aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 143aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 144aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 145aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abcd"; 146aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("^abc"))); 147aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 148aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 149aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 150aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 151aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "aabc"; 152aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("^abc"))); 153aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 154aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 155aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 156aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 157aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abc"; 158aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("abc$"))); 159aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 160aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 161aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 162aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 163aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 164aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 165aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 166aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 167aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 168aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 169aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 170aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 171aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 172aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "efabc"; 173aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("abc$"))); 174aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 175aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 176aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 177aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 178aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "efabcg"; 179aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("abc$"))); 180aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 181aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 182aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 183aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 184aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abc"; 185aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("a.c"))); 186aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 187aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 188aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 189aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 190aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 191aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 192aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 193aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 194aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 195aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 196aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 197aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 198aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 199aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "acc"; 200aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("a.c"))); 201aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 202aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 203aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 204aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 205aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 206aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 207aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 208aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 209aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 210aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 211aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 212aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 213aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 214aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "acc"; 215aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("a.c"))); 216aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 217aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 218aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 219aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 220aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 221aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 222aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 223aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 224aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 225aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 226aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 227aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 228aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 229aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abcdef"; 230aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("(.*).*"))); 231aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 2); 232aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 233aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 234aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 235aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 236aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 237aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+6); 238aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 6); 239aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 240aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 241aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(1) == 6); 242aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(1) == 0); 243aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(1) == s); 244aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 245aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 246aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 247aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "bc"; 248aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("(a*)*"))); 249aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 250aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 251aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 252aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 253aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abbc"; 254aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("ab{3,5}c"))); 255aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 256aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 257aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 258aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 259aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abbbc"; 260aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("ab{3,5}c"))); 261aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 262aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 263aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 264aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 265aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 266aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 267aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 268aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 269aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 270aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 271aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 272aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 273aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 274aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abbbbc"; 275aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("ab{3,5}c"))); 276aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 277aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 278aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 279aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 280aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 281aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 282aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 283aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 284aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 285aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 286aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 287aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 288aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 289aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abbbbbc"; 290aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("ab{3,5}c"))); 291aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 292aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 293aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 294aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 295aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 296aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 297aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 298aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 299aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 300aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 301aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 302aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 303aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 304aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "adefc"; 305aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("ab{3,5}c"))); 306aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 307aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 308aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 309aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 310aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "abbbbbbc"; 311aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("ab{3,5}c"))); 312aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 313aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 314aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 315aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 316aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "adec"; 317aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("a.{3,5}c"))); 318aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 319aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 320aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 321aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 322aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "adefc"; 323aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("a.{3,5}c"))); 324aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 325aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 326aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 327aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 328aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 329aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 330aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 331aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 332aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 333aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 334aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 335aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 336aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 337aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "adefgc"; 338aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("a.{3,5}c"))); 339aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 340aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 341aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 342aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 343aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 344aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 345aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 346aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 347aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 348aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 349aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 350aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 351aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 352aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "adefghc"; 353aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("a.{3,5}c"))); 354aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 355aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 356aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 357aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 358aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 359aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 360aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 361aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 362aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 363aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 364aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 365aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 366aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 367aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "adefghic"; 368aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("a.{3,5}c"))); 369aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 370aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 371aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 372aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 373aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "tournament"; 374aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("tour|to|tournament"))); 375aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 376aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 377aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 378aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 379aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "tournamenttotour"; 380aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("(tour|to|tournament)+", 381aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::regex_constants::nosubs))); 382aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 383aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 384aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 385aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 386aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "ttotour"; 387aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("(tour|to|t)+"))); 388aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 2); 389aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 390aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 391aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 392aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 393aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 394aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 395aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 396aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 397aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 398aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(1) == 4); 399aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(1) == 3); 400aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(1) == "tour"); 401aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 402aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 403aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 404aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "-ab,ab-"; 405aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("-(.*),\1-"))); 406aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 407aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 408aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 409aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 410aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "-ab,ab-"; 411aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("-.*,.*-"))); 412aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 413aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 414aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 415aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 416aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 417aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 418aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 419aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 420aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 421aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 422aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 423aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 424aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 425aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "a"; 426aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("^[a]$"))); 427aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 428aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 429aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 430aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 431aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 432aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 433aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 434aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 1); 435aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 436aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == "a"); 437aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 438aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 439aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 440aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "a"; 441aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("^[ab]$"))); 442aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 443aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 444aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 445aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 446aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 447aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 448aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 449aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 1); 450aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 451aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == "a"); 452aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 453aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 454aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 455aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "c"; 456aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("^[a-f]$"))); 457aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 458aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 459aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 460aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 461aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 462aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 463aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 464aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 1); 465aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 466aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 467aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 468aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 469aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 470aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "g"; 471aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("^[a-f]$"))); 472aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 473aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 474aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 475aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 476aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "Iraqi"; 477aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("q[^u]"))); 478aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 479aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 480aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 481aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 482aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "Iraq"; 483aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("q[^u]"))); 484aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 485aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 486aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 487aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 488aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "AmB"; 489aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("A[[:lower:]]B"))); 490aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 491aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 492aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 493aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 494aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 495aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 496aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 497aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 498aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 499aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 500aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 501aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 502aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 503aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "AMB"; 504aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("A[[:lower:]]B"))); 505aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 506aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 507aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 508aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 509aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "AMB"; 510aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("A[^[:lower:]]B"))); 511aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 512aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 513aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 514aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 515aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 516aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 517aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 518aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 519aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 520aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 521aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 522aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 523aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 524aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "AmB"; 525aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("A[^[:lower:]]B"))); 526aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 527aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 528aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 529aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 530aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "A5B"; 531aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("A[^[:lower:]0-9]B"))); 532aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 533aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 534aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 535aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 536aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "A?B"; 537aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("A[^[:lower:]0-9]B"))); 538aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 539aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 540aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 541aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 542aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 543aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 544aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 545aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 546aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 547aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 548aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 549aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 550aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 551aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "-"; 552aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("[a[.hyphen.]z]"))); 553aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 554aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 555aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 556aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 557aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 558aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 559aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 560aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 561aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 562aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 563aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 564aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 565aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 566aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "z"; 567aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("[a[.hyphen.]z]"))); 568aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 569aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 570aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 571aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 572aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 573aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 574aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 575aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 576aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 577aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 578aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 579aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 580aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 581aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "m"; 582aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("[a[.hyphen.]z]"))); 583aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 584aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 585eda3fcaaedc2c6a13fce15fbe5fd472b642dc830Ed Schouten std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); 586aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 587aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 588aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "m"; 589aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("[a[=M=]z]"))); 590aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 591aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 592aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 593aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 594aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 595aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 596aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 597aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 598aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 599aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 600aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 601aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 602aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 603aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "Ch"; 604aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("[a[.ch.]z]", 605aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::regex_constants::icase))); 606aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 607aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 608aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 609aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 610aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 611aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 612aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 613aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 614aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 615aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 616aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 6176b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow { 6186b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow std::cmatch m; 6196b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow const char s[] = "foobar"; 6206b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow assert(std::regex_match(s, m, std::regex("[^\\0]*"))); 6216b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow assert(m.size() == 1); 6226b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow } 6236b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow { 6246b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow std::cmatch m; 6256b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow const char s[] = "foo\0bar"; 6266b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow assert(std::regex_match(s, s+7, m, std::regex("[abfor\\0]*"))); 6276b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow assert(m.size() == 1); 6286b7e6921e204ed1e1b8c232872af123facbcad65Marshall Clow } 629aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::locale::global(std::locale("C")); 630aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 631aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 632aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "m"; 633aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("[a[=M=]z]"))); 634aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 635aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 636aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 637aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 638aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "01a45cef9"; 639aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("[ace1-9]*"))); 640aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 641aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 642aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 643aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 644aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "01a45cef9"; 645aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("[ace1-9]+"))); 646aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 647aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 648aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 649aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char r[] = "^[-+]?[0-9]+[CF]$"; 650aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::ptrdiff_t sr = std::char_traits<char>::length(r); 651aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant typedef forward_iterator<const char*> FI; 652aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant typedef bidirectional_iterator<const char*> BI; 653aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::regex regex(FI(r), FI(r+sr)); 654aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::match_results<BI> m; 655aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "-40C"; 656aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::ptrdiff_t ss = std::char_traits<char>::length(s); 657aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(BI(s), BI(s+ss), m, regex)); 658aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 659aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 660aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == BI(s)); 661aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 662aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 663aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 664aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 665aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 4); 666aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 667aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 668aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 669aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 670aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 671aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "Jeff Jeffs "; 672aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("Jeff(?=s\\b)"))); 673aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 674aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 675aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 676aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 677aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "Jeffs Jeff"; 678aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::regex("Jeff(?!s\\b)"))); 679aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 680aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 681aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 682aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::cmatch m; 683aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const char s[] = "5%k"; 684aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::regex("\\d[\\W]k"))); 685aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 686aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 687aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 688aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 689aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 690aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 691aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s + std::char_traits<char>::length(s)); 692aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<char>::length(s)); 693aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 694aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 695aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 696aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant 697aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 698aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 699aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"a"; 700aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"a"))); 701aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 702aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.empty()); 703aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 704aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 705aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 706aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 707aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 708aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+1); 709aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 1); 710aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 711aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == L"a"); 712aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 713aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 714aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 715aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"ab"; 716aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"ab"))); 717aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 718aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 719aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 720aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 721aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 722aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 723aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+2); 724aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 2); 725aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 726aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == L"ab"); 727aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 728aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 729aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 730aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"ab"; 731aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"ba"))); 732aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 733aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.empty()); 734aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 735aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 736aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 737aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"aab"; 738aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"ab"))); 739aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 740aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 741aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 742aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 743aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"aab"; 744aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"ab"), 745aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::regex_constants::match_continuous)); 746aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 747aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 748aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 749aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 750aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abcd"; 751aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"bc"))); 752aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 753aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 754aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 755aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 756aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abbc"; 757aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"ab*c"))); 758aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 759aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 760aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 761aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 762aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 763aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 764aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+4); 765aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 4); 766aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 767aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 768aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 769aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 770aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 771aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"ababc"; 772aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"(ab)*c"))); 773aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 2); 774aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 775aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 776aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 777aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 778aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 779aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+5); 780aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 5); 781aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 782aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 783aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(1) == 2); 784aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(1) == 2); 785aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(1) == L"ab"); 786aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 787aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 788aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 789aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abcdefghijk"; 790aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"cd((e)fg)hi"))); 791aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 792aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 793aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 794aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 795aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abc"; 796aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"^abc"))); 797aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 798aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 799aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 800aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 801aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 802aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 803aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 804aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 805aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 806aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 807aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 808aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 809aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 810aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abcd"; 811aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"^abc"))); 812aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 813aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 814aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 815aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 816aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"aabc"; 817aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"^abc"))); 818aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 819aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 820aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 821aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 822aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abc"; 823aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"abc$"))); 824aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 825aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 826aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 827aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 828aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 829aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 830aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 831aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 832aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 833aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 834aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 835aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 836aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 837aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"efabc"; 838aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"abc$"))); 839aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 840aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 841aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 842aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 843aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"efabcg"; 844aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"abc$"))); 845aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 846aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 847aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 848aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 849aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abc"; 850aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"a.c"))); 851aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 852aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 853aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 854aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 855aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 856aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 857aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 858aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 859aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 860aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 861aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 862aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 863aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 864aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"acc"; 865aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"a.c"))); 866aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 867aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 868aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 869aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 870aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 871aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 872aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 873aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 874aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 875aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 876aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 877aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 878aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 879aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"acc"; 880aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"a.c"))); 881aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 882aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 883aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 884aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 885aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 886aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 887aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+3); 888aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 3); 889aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 890aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 891aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 892aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 893aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 894aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abcdef"; 895aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"(.*).*"))); 896aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 2); 897aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 898aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 899aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 900aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 901aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 902aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s+6); 903aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 6); 904aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 905aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 906aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(1) == 6); 907aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(1) == 0); 908aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(1) == s); 909aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 910aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 911aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 912aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"bc"; 913aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"(a*)*"))); 914aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 915aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 916aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 917aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 918aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abbc"; 919aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"ab{3,5}c"))); 920aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 921aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 922aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 923aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 924aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abbbc"; 925aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"ab{3,5}c"))); 926aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 927aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 928aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 929aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 930aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 931aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 932aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 933aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 934aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 935aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 936aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 937aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 938aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 939aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abbbbc"; 940aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"ab{3,5}c"))); 941aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 942aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 943aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 944aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 945aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 946aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 947aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 948aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 949aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 950aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 951aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 952aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 953aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 954aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abbbbbc"; 955aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"ab{3,5}c"))); 956aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 957aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 958aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 959aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 960aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 961aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 962aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 963aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 964aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 965aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 966aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 967aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 968aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 969aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"adefc"; 970aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"ab{3,5}c"))); 971aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 972aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 973aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 974aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 975aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"abbbbbbc"; 976aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"ab{3,5}c"))); 977aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 978aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 979aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 980aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 981aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"adec"; 982aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"a.{3,5}c"))); 983aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 984aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 985aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 986aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 987aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"adefc"; 988aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"a.{3,5}c"))); 989aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 990aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 991aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 992aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 993aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 994aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 995aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 996aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 997aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 998aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 999aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1000aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1001aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1002aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"adefgc"; 1003aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"a.{3,5}c"))); 1004aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1005aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1006aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1007aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1008aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1009aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1010aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1011aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1012aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1013aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1014aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1015aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1016aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1017aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"adefghc"; 1018aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"a.{3,5}c"))); 1019aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1020aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1021aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1022aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1023aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1024aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1025aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1026aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1027aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1028aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1029aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1030aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1031aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1032aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"adefghic"; 1033aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"a.{3,5}c"))); 1034aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1035aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1036aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1037aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1038aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"tournament"; 1039aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"tour|to|tournament"))); 1040aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1041aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1042aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1043aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1044aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"tournamenttotour"; 1045aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"(tour|to|tournament)+", 1046aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::regex_constants::nosubs))); 1047aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1048aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1049aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1050aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1051aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"ttotour"; 1052aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"(tour|to|t)+"))); 1053aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 2); 1054aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1055aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1056aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1057aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1058aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1059aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1060aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1061aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1062aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1063aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(1) == 4); 1064aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(1) == 3); 1065aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(1) == L"tour"); 1066aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1067aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1068aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1069aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"-ab,ab-"; 1070aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"-(.*),\1-"))); 1071aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1072aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1073aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1074aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1075aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"-ab,ab-"; 1076aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"-.*,.*-"))); 1077aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1078aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1079aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1080aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1081aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1082aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1083aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1084aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1085aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1086aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1087aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1088aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1089aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1090aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"a"; 1091aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"^[a]$"))); 1092aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1093aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1094aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1095aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1096aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1097aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1098aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1099aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 1); 1100aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1101aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == L"a"); 1102aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1103aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1104aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1105aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"a"; 1106aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"^[ab]$"))); 1107aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1108aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1109aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1110aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1111aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1112aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1113aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1114aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 1); 1115aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1116aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == L"a"); 1117aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1118aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1119aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1120aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"c"; 1121aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"^[a-f]$"))); 1122aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1123aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1124aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1125aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1126aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1127aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1128aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1129aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 1); 1130aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1131aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1132aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1133aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1134aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1135aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"g"; 1136aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"^[a-f]$"))); 1137aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1138aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1139aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1140aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1141aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"Iraqi"; 1142aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"q[^u]"))); 1143aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1144aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1145aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1146aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1147aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"Iraq"; 1148aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"q[^u]"))); 1149aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1150aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1151aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1152aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1153aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"AmB"; 1154aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"A[[:lower:]]B"))); 1155aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1156aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1157aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1158aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1159aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1160aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1161aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1162aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1163aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1164aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1165aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1166aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1167aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1168aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"AMB"; 1169aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"A[[:lower:]]B"))); 1170aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1171aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1172aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1173aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1174aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"AMB"; 1175aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"A[^[:lower:]]B"))); 1176aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1177aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1178aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1179aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1180aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1181aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1182aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1183aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1184aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1185aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1186aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1187aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1188aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1189aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"AmB"; 1190aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"A[^[:lower:]]B"))); 1191aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1192aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1193aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1194aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1195aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"A5B"; 1196aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"A[^[:lower:]0-9]B"))); 1197aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1198aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1199aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1200aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1201aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"A?B"; 1202aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"A[^[:lower:]0-9]B"))); 1203aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1204aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1205aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1206aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1207aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1208aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1209aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1210aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1211aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1212aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1213aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1214aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1215aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1216aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"-"; 1217aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"[a[.hyphen.]z]"))); 1218aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1219aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1220aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1221aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1222aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1223aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1224aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1225aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1226aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1227aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1228aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1229aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1230aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1231aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"z"; 1232aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"[a[.hyphen.]z]"))); 1233aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1234aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1235aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1236aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1237aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1238aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1239aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1240aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1241aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1242aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1243aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1244aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1245aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1246aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"m"; 1247aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"[a[.hyphen.]z]"))); 1248aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1249aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1250eda3fcaaedc2c6a13fce15fbe5fd472b642dc830Ed Schouten std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2)); 1251aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1252aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1253aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"m"; 1254aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"[a[=M=]z]"))); 1255aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1256aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1257aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1258aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1259aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1260aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1261aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1262aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1263aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1264aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1265aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1266aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1267aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1268aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"Ch"; 1269aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"[a[.ch.]z]", 1270aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::regex_constants::icase))); 1271aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1272aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1273aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1274aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1275aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1276aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1277aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1278aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1279aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1280aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1281aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1282aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::locale::global(std::locale("C")); 1283aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1284aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1285aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"m"; 1286aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"[a[=M=]z]"))); 1287aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1288aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1289aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1290aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1291aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"01a45cef9"; 1292aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"[ace1-9]*"))); 1293aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1294aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1295aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1296aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1297aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"01a45cef9"; 1298aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"[ace1-9]+"))); 1299aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1300aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1301aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1302aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t r[] = L"^[-+]?[0-9]+[CF]$"; 1303aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::ptrdiff_t sr = std::char_traits<wchar_t>::length(r); 1304aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant typedef forward_iterator<const wchar_t*> FI; 1305aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant typedef bidirectional_iterator<const wchar_t*> BI; 1306aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wregex regex(FI(r), FI(r+sr)); 1307aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::match_results<BI> m; 1308aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"-40C"; 1309aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::ptrdiff_t ss = std::char_traits<wchar_t>::length(s); 1310aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(BI(s), BI(s+ss), m, regex)); 1311aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1312aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1313aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == BI(s)); 1314aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1315aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1316aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1317aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == m[0].second); 1318aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == 4); 1319aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1320aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1321aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1322aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1323aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1324aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"Jeff Jeffs "; 1325aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"Jeff(?=s\\b)"))); 1326aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1327aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1328aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1329aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1330aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"Jeffs Jeff"; 1331aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!std::regex_match(s, m, std::wregex(L"Jeff(?!s\\b)"))); 1332aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 0); 1333aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1334aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant { 1335aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant std::wcmatch m; 1336aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant const wchar_t s[] = L"5%k"; 1337aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(std::regex_match(s, m, std::wregex(L"\\d[\\W]k"))); 1338aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.size() == 1); 1339aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.prefix().matched); 1340aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().first == s); 1341aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.prefix().second == m[0].first); 1342aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(!m.suffix().matched); 1343aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().first == m[0].second); 1344aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.suffix().second == s + std::char_traits<wchar_t>::length(s)); 1345aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.length(0) == std::char_traits<wchar_t>::length(s)); 1346aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.position(0) == 0); 1347aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant assert(m.str(0) == s); 1348aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant } 1349aa78f9cdb3c8a049660deb39c9296501d2467d78Howard Hinnant} 1350