31 namespace std _GLIBCXX_VISIBILITY(default)
33 _GLIBCXX_BEGIN_NAMESPACE_VERSION
34 _GLIBCXX_BEGIN_NAMESPACE_CXX11
35 template<
typename,
typename>
38 template<
typename,
typename>
41 _GLIBCXX_END_NAMESPACE_CXX11
45 enum class _RegexExecutorPolicy : int { _S_auto, _S_alternate };
47 template<
typename _BiIter,
typename _Alloc,
48 typename _CharT,
typename _TraitsT,
49 _RegexExecutorPolicy __policy,
52 __regex_algo_impl(_BiIter __s,
58 template<
typename,
typename,
typename,
bool>
62 _GLIBCXX_BEGIN_NAMESPACE_CXX11
79 template<
typename _Ch_type>
83 typedef _Ch_type char_type;
89 typedef std::ctype_base::mask _BaseType;
91 unsigned char _M_extended;
92 static constexpr
unsigned char _S_under = 1 << 0;
93 static constexpr
unsigned char _S_valid_mask = 0x1;
95 constexpr _RegexMask(_BaseType
__base = 0,
96 unsigned char __extended = 0)
97 : _M_base(
__base), _M_extended(__extended)
103 return _RegexMask(_M_base & __other._M_base,
104 _M_extended & __other._M_extended);
110 return _RegexMask(_M_base | __other._M_base,
111 _M_extended | __other._M_extended);
117 return _RegexMask(_M_base ^ __other._M_base,
118 _M_extended ^ __other._M_extended);
123 {
return _RegexMask(~_M_base, ~_M_extended); }
126 operator&=(_RegexMask __other)
127 {
return *
this = (*this) & __other; }
130 operator|=(_RegexMask __other)
131 {
return *
this = (*this) | __other; }
134 operator^=(_RegexMask __other)
135 {
return *
this = (*this) ^ __other; }
138 operator==(_RegexMask __other)
const 140 return (_M_extended & _S_valid_mask)
141 == (__other._M_extended & _S_valid_mask)
142 && _M_base == __other._M_base;
146 operator!=(_RegexMask __other)
const 147 {
return !((*this) == __other); }
151 typedef _RegexMask char_class_type;
171 {
return string_type::traits_type::length(__p); }
197 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
198 return __fctyp.tolower(__c);
221 template<
typename _Fwd_iter>
226 const __collate_type& __fclt(use_facet<__collate_type>(_M_locale));
228 return __fclt.transform(__s.
data(), __s.
data() + __s.
size());
245 template<
typename _Fwd_iter>
256 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
273 template<
typename _Fwd_iter>
314 template<
typename _Fwd_iter>
317 bool __icase =
false)
const;
332 isctype(_Ch_type __c, char_class_type __f)
const;
345 value(_Ch_type __ch,
int __radix)
const;
361 std::swap(_M_locale, __loc);
371 {
return _M_locale; }
374 locale_type _M_locale;
385 template<
typename _Ch_type,
typename _Rx_traits = regex_traits<_Ch_type>>
389 static_assert(is_same<_Ch_type, typename _Rx_traits::char_type>::value,
390 "regex traits class must have the same char_type");
393 typedef _Ch_type value_type;
394 typedef _Rx_traits traits_type;
395 typedef typename traits_type::string_type string_type;
397 typedef typename traits_type::locale_type locale_type;
422 : _M_flags(ECMAScript), _M_loc(), _M_automaton(nullptr)
481 template<
typename _Ch_traits,
typename _Ch_alloc>
486 :
basic_regex(__s.data(), __s.data() + __s.size(), __f)
502 template<
typename _FwdIter>
531 {
return this->
assign(__rhs); }
538 {
return this->
assign(std::move(__rhs)); }
549 {
return this->
assign(__p); }
561 {
return this->
assign(__l.begin(), __l.end()); }
569 template<
typename _Ch_traits,
typename _Alloc>
572 {
return this->
assign(__s); }
616 {
return this->
assign(string_type(__p), __flags); }
633 {
return this->
assign(string_type(__p, __len), __flags); }
646 template<
typename _Ch_traits,
typename _Alloc>
668 template<
typename _InputIterator>
670 assign(_InputIterator __first, _InputIterator __last,
672 {
return this->
assign(string_type(__first, __last), __flags); }
687 {
return this->
assign(__l.begin(), __l.end(), __flags); }
698 return _M_automaton->_M_sub_count() - 1;
719 std::swap(__loc, _M_loc);
720 _M_automaton.reset();
741 std::swap(_M_flags, __rhs._M_flags);
742 std::swap(_M_loc, __rhs._M_loc);
743 std::swap(_M_automaton, __rhs._M_automaton);
746 #ifdef _GLIBCXX_DEBUG 749 { _M_automaton->_M_dot(__ostr); }
755 template<
typename _FwdIter>
756 basic_regex(_FwdIter __first, _FwdIter __last, locale_type __loc,
758 : _M_flags(__f), _M_loc(
std::move(__loc)),
759 _M_automaton(__detail::__compile_nfa<_Rx_traits>(
760 std::move(__first),
std::move(__last), _M_loc, _M_flags))
763 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
764 __detail::_RegexExecutorPolicy,
bool>
766 __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
767 const basic_regex<_Cp, _Rp>&,
770 template<
typename,
typename,
typename,
bool>
771 friend class __detail::_Executor;
775 _AutomatonPtr _M_automaton;
778 #if __cplusplus < 201703L 779 template<
typename _Ch,
typename _Tr>
783 template<
typename _Ch,
typename _Tr>
787 template<
typename _Ch,
typename _Tr>
791 template<
typename _Ch,
typename _Tr>
795 template<
typename _Ch,
typename _Tr>
799 template<
typename _Ch,
typename _Tr>
803 template<
typename _Ch,
typename _Tr>
807 template<
typename _Ch,
typename _Tr>
811 template<
typename _Ch,
typename _Tr>
815 template<
typename _Ch,
typename _Tr>
820 #if __cpp_deduction_guides >= 201606 821 template<
typename _ForwardIterator>
822 basic_regex(_ForwardIterator, _ForwardIterator,
824 -> basic_regex<
typename iterator_traits<_ForwardIterator>::value_type>;
830 #ifdef _GLIBCXX_USE_WCHAR_T 842 template<
typename _Ch_type,
typename _Rx_traits>
846 { __lhs.swap(__rhs); }
862 template<
typename _BiIter>
865 typedef iterator_traits<_BiIter> __iter_traits;
868 typedef typename __iter_traits::value_type value_type;
869 typedef typename __iter_traits::difference_type difference_type;
870 typedef _BiIter iterator;
875 constexpr
sub_match() noexcept : matched() { }
892 operator string_type()
const 919 {
return this->_M_str().compare(__s._M_str()); }
933 {
return this->_M_str().compare(__s); }
937 {
return this->_M_str().compare(__s); }
942 _M_compare(
const value_type* __s,
size_t __n)
const 943 {
return this->_M_str().compare({__s, __n}); }
949 using traits_type =
typename string_type::traits_type;
951 __string_view() =
default;
953 __string_view(
const value_type* __s,
size_t __n) noexcept
954 : _M_data(__s), _M_len(__n) { }
956 __string_view(
const value_type* __s) noexcept
957 : _M_data(__s), _M_len(traits_type::length(__s)) { }
959 __string_view(
const string_type& __s) noexcept
960 : _M_data(__s.data()), _M_len(__s.length()) { }
963 compare(__string_view __s)
const noexcept
965 if (
const size_t __n =
std::min(_M_len, __s._M_len))
966 if (
int __ret = traits_type::compare(_M_data, __s._M_data, __n))
968 const difference_type __diff = _M_len - __s._M_len;
973 return static_cast<int>(__diff);
977 const value_type* _M_data =
nullptr;
982 template<
typename _Iter = _BiIter>
983 __enable_if_t<__detail::__is_contiguous_iter<_Iter>::value,
985 _M_str() const noexcept
994 template<
typename _Iter = _BiIter>
995 __enable_if_t<!__detail::__is_contiguous_iter<_Iter>::value,
1008 #ifdef _GLIBCXX_USE_WCHAR_T 1024 template<
typename _BiIter>
1027 {
return __lhs.
compare(__rhs) == 0; }
1035 template<
typename _BiIter>
1038 {
return __lhs.
compare(__rhs) != 0; }
1046 template<
typename _BiIter>
1049 {
return __lhs.
compare(__rhs) < 0; }
1057 template<
typename _BiIter>
1060 {
return __lhs.
compare(__rhs) <= 0; }
1068 template<
typename _BiIter>
1071 {
return __lhs.
compare(__rhs) >= 0; }
1079 template<
typename _BiIter>
1082 {
return __lhs.
compare(__rhs) > 0; }
1085 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1086 using __sub_match_string = basic_string<
1087 typename iterator_traits<_Bi_iter>::value_type,
1088 _Ch_traits, _Ch_alloc>;
1097 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1101 {
return __rhs._M_compare(__lhs.
data(), __lhs.
size()) == 0; }
1110 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1114 {
return !(__lhs == __rhs); }
1122 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1124 operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1126 {
return __rhs._M_compare(__lhs.data(), __lhs.size()) > 0; }
1134 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1138 {
return __rhs < __lhs; }
1146 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1150 {
return !(__lhs < __rhs); }
1158 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1160 operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1162 {
return !(__rhs < __lhs); }
1171 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1175 {
return __lhs._M_compare(__rhs.
data(), __rhs.
size()) == 0; }
1184 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1188 {
return !(__lhs == __rhs); }
1196 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1198 operator<(const sub_match<_Bi_iter>& __lhs,
1200 {
return __lhs._M_compare(__rhs.data(), __rhs.size()) < 0; }
1208 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1212 {
return __rhs < __lhs; }
1220 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1224 {
return !(__lhs < __rhs); }
1232 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1234 operator<=(const sub_match<_Bi_iter>& __lhs,
1236 {
return !(__rhs < __lhs); }
1245 template<
typename _Bi_iter>
1247 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1249 {
return __rhs.
compare(__lhs) == 0; }
1258 template<
typename _Bi_iter>
1260 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1262 {
return !(__lhs == __rhs); }
1270 template<
typename _Bi_iter>
1272 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1274 {
return __rhs.
compare(__lhs) > 0; }
1282 template<
typename _Bi_iter>
1284 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1286 {
return __rhs < __lhs; }
1294 template<
typename _Bi_iter>
1296 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1298 {
return !(__lhs < __rhs); }
1306 template<
typename _Bi_iter>
1308 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1310 {
return !(__rhs < __lhs); }
1319 template<
typename _Bi_iter>
1322 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1323 {
return __lhs.
compare(__rhs) == 0; }
1332 template<
typename _Bi_iter>
1335 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1336 {
return !(__lhs == __rhs); }
1344 template<
typename _Bi_iter>
1346 operator<(const sub_match<_Bi_iter>& __lhs,
1347 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1348 {
return __lhs.compare(__rhs) < 0; }
1356 template<
typename _Bi_iter>
1359 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1360 {
return __rhs < __lhs; }
1368 template<
typename _Bi_iter>
1371 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1372 {
return !(__lhs < __rhs); }
1380 template<
typename _Bi_iter>
1382 operator<=(const sub_match<_Bi_iter>& __lhs,
1383 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1384 {
return !(__rhs < __lhs); }
1393 template<
typename _Bi_iter>
1395 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1406 template<
typename _Bi_iter>
1408 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1410 {
return !(__lhs == __rhs); }
1419 template<
typename _Bi_iter>
1421 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1432 template<
typename _Bi_iter>
1434 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1436 {
return __rhs < __lhs; }
1445 template<
typename _Bi_iter>
1447 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1449 {
return !(__lhs < __rhs); }
1458 template<
typename _Bi_iter>
1460 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1462 {
return !(__rhs < __lhs); }
1471 template<
typename _Bi_iter>
1474 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1484 template<
typename _Bi_iter>
1487 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1488 {
return !(__lhs == __rhs); }
1497 template<
typename _Bi_iter>
1499 operator<(const sub_match<_Bi_iter>& __lhs,
1500 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1510 template<
typename _Bi_iter>
1513 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1514 {
return __rhs < __lhs; }
1523 template<
typename _Bi_iter>
1526 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1527 {
return !(__lhs < __rhs); }
1536 template<
typename _Bi_iter>
1538 operator<=(const sub_match<_Bi_iter>& __lhs,
1539 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1540 {
return !(__rhs < __lhs); }
1550 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1552 basic_ostream<_Ch_type, _Ch_traits>&
1553 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1555 {
return __os << __m.
str(); }
1581 template<
typename _Bi_iter,
1582 typename _Alloc = allocator<sub_match<_Bi_iter> > >
1584 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1604 typedef std::iterator_traits<_Bi_iter> __iter_traits;
1612 typedef sub_match<_Bi_iter> value_type;
1613 typedef const value_type& const_reference;
1614 typedef value_type& reference;
1615 typedef typename _Base_type::const_iterator const_iterator;
1616 typedef const_iterator iterator;
1617 typedef typename __iter_traits::difference_type difference_type;
1619 typedef _Alloc allocator_type;
1620 typedef typename __iter_traits::value_type char_type;
1708 _GLIBCXX_NODISCARD
bool 1710 {
return size() == 0; }
1729 {
return (*
this)[__sub].length(); }
1756 str(size_type __sub = 0)
const 1773 __glibcxx_assert(
ready() );
1774 return __sub <
size()
1776 : _M_unmatched_sub();
1790 __glibcxx_assert(
ready() );
1791 return !
empty() ? _M_prefix() : _M_unmatched_sub();
1805 __glibcxx_assert(
ready() );
1806 return !
empty() ? _M_suffix() : _M_unmatched_sub();
1821 {
return this->
begin(); }
1835 {
return this->
end(); }
1852 template<
typename _Out_iter>
1854 format(_Out_iter __out,
const char_type* __fmt_first,
1855 const char_type* __fmt_last,
1861 template<
typename _Out_iter,
typename _St,
typename _Sa>
1873 template<
typename _St,
typename _Sa>
1910 {
return _Base_type::get_allocator(); }
1927 swap(_M_begin, __that._M_begin);
1932 template<
typename,
typename,
typename,
bool>
1935 template<
typename,
typename,
typename>
1938 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
1939 __detail::_RegexExecutorPolicy,
bool>
1946 _M_resize(
unsigned int __size)
1950 _M_unmatched_sub()
const 1953 sub_match<_Bi_iter>&
1961 sub_match<_Bi_iter>&
1969 sub_match<_Bi_iter>&
1976 typedef match_results<const char*> cmatch;
1977 typedef match_results<string::const_iterator> smatch;
1978 #ifdef _GLIBCXX_USE_WCHAR_T 1979 typedef match_results<const wchar_t*> wcmatch;
1980 typedef match_results<wstring::const_iterator> wsmatch;
1989 template<
typename _Bi_iter,
typename _Alloc>
1994 if (__m1.ready() != __m2.ready())
1998 if (__m1.empty() != __m2.empty())
2002 return __m1.prefix() == __m2.prefix()
2003 && __m1.size() == __m2.size()
2004 &&
std::equal(__m1.begin(), __m1.end(), __m2.begin())
2005 && __m1.suffix() == __m2.suffix();
2013 template<
typename _Bi_iter,
class _Alloc>
2017 {
return !(__m1 == __m2); }
2027 template<
typename _Bi_iter,
typename _Alloc>
2031 { __lhs.swap(__rhs); }
2033 _GLIBCXX_END_NAMESPACE_CXX11
2056 template<
typename _Bi_iter,
typename _Alloc,
2057 typename _Ch_type,
typename _Rx_traits>
2066 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2067 __detail::_RegexExecutorPolicy::_S_auto,
true>
2068 (__s, __e, __m, __re, __flags);
2085 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2093 return regex_match(__first, __last, __what, __re, __flags);
2110 template<
typename _Ch_type,
typename _Alloc,
typename _Rx_traits>
2117 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2133 template<
typename _Ch_traits,
typename _Ch_alloc,
2134 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2138 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2147 template<
typename _Ch_traits,
typename _Ch_alloc,
2148 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2150 regex_match(
const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&,
2151 match_results<
typename basic_string<_Ch_type,
2152 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2153 const basic_regex<_Ch_type, _Rx_traits>&,
2170 template<
typename _Ch_type,
class _Rx_traits>
2176 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2191 template<
typename _Ch_traits,
typename _Str_allocator,
2192 typename _Ch_type,
typename _Rx_traits>
2214 template<
typename _Bi_iter,
typename _Alloc,
2215 typename _Ch_type,
typename _Rx_traits>
2223 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2224 __detail::_RegexExecutorPolicy::_S_auto,
false>
2225 (__s, __e, __m, __re, __flags);
2239 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2247 return regex_search(__first, __last, __what, __re, __flags);
2262 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2269 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2281 template<
typename _Ch_type,
typename _Rx_traits>
2287 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2299 template<
typename _Ch_traits,
typename _String_allocator,
2300 typename _Ch_type,
typename _Rx_traits>
2303 _String_allocator>& __s,
2307 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2321 template<
typename _Ch_traits,
typename _Ch_alloc,
2322 typename _Alloc,
typename _Ch_type,
2323 typename _Rx_traits>
2327 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2336 template<
typename _Ch_traits,
typename _Ch_alloc,
2337 typename _Alloc,
typename _Ch_type,
2338 typename _Rx_traits>
2340 regex_search(
const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&,
2341 match_results<
typename basic_string<_Ch_type,
2342 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2343 const basic_regex<_Ch_type, _Rx_traits>&,
2361 template<
typename _Out_iter,
typename _Bi_iter,
2362 typename _Rx_traits,
typename _Ch_type,
2363 typename _St,
typename _Sa>
2387 template<
typename _Out_iter,
typename _Bi_iter,
2388 typename _Rx_traits,
typename _Ch_type>
2390 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
2391 const basic_regex<_Ch_type, _Rx_traits>& __e,
2392 const _Ch_type* __fmt,
2407 template<
typename _Rx_traits,
typename _Ch_type,
2408 typename _St,
typename _Sa,
typename _Fst,
typename _Fsa>
2409 inline basic_string<_Ch_type, _St, _Sa>
2418 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2433 template<
typename _Rx_traits,
typename _Ch_type,
2434 typename _St,
typename _Sa>
2435 inline basic_string<_Ch_type, _St, _Sa>
2438 const _Ch_type* __fmt,
2444 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2459 template<
typename _Rx_traits,
typename _Ch_type,
2460 typename _St,
typename _Sa>
2461 inline basic_string<_Ch_type>
2471 __e, __fmt, __flags);
2486 template<
typename _Rx_traits,
typename _Ch_type>
2487 inline basic_string<_Ch_type>
2490 const _Ch_type* __fmt,
2497 __e, __fmt, __flags);
2503 _GLIBCXX_BEGIN_NAMESPACE_CXX11
2510 template<
typename _Bi_iter,
2511 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2512 typename _Rx_traits = regex_traits<_Ch_type> >
2518 typedef std::ptrdiff_t difference_type;
2539 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2541 if (!
regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags))
2571 {
return !(*
this == __rhs); }
2578 {
return _M_match; }
2585 {
return &_M_match; }
2605 _Bi_iter _M_begin {};
2607 const regex_type* _M_pregex =
nullptr;
2609 match_results<_Bi_iter> _M_match;
2612 typedef regex_iterator<const char*> cregex_iterator;
2613 typedef regex_iterator<string::const_iterator> sregex_iterator;
2614 #ifdef _GLIBCXX_USE_WCHAR_T 2615 typedef regex_iterator<const wchar_t*> wcregex_iterator;
2616 typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
2627 template<
typename _Bi_iter,
2628 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2629 typename _Rx_traits = regex_traits<_Ch_type> >
2635 typedef std::ptrdiff_t difference_type;
2649 : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr),
2674 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2675 { _M_init(__a, __b); }
2691 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2692 { _M_init(__a, __b); }
2708 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2709 { _M_init(__a, __b); }
2720 template<std::
size_t _Nm>
2723 const int (&__submatches)[_Nm],
2726 : _M_position(__a, __b, __re, __m),
2727 _M_subs(__submatches, __submatches + _Nm), _M_n(0)
2728 { _M_init(__a, __b); }
2743 template <std::
size_t _Nm>
2754 : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
2755 _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
2756 { _M_normalize_result(); }
2776 {
return !(*
this == __rhs); }
2783 {
return *_M_result; }
2790 {
return _M_result; }
2813 _M_init(_Bi_iter __a, _Bi_iter __b);
2816 _M_current_match()
const 2818 if (_M_subs[_M_n] == -1)
2819 return (*_M_position).prefix();
2821 return (*_M_position)[_M_subs[_M_n]];
2825 _M_end_of_seq()
const 2826 {
return _M_result ==
nullptr; }
2830 _M_normalize_result()
2832 if (_M_position != _Position())
2833 _M_result = &_M_current_match();
2835 _M_result = &_M_suffix;
2837 _M_result =
nullptr;
2840 _Position _M_position;
2842 value_type _M_suffix;
2844 const value_type* _M_result;
2856 #ifdef _GLIBCXX_USE_WCHAR_T 2866 _GLIBCXX_END_NAMESPACE_CXX11
2867 _GLIBCXX_END_NAMESPACE_VERSION
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
Describes aspects of a regular expression.
_BiIter second
first is a copy of the first object
bool equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
Tests a range for element-wise equality.
difference_type length(size_type __sub=0) const
Gets the length of the indicated submatch.
const_iterator begin() const noexcept
Gets an iterator to the start of the sub_match collection.
const_reference prefix() const
Gets a sub_match representing the match prefix.
basic_regex & operator=(const basic_string< _Ch_type, _Ch_traits, _Alloc > &__s)
Replaces a regular expression with a new one constructed from a string.
basic_regex(const _Ch_type *__p, flag_type __f=ECMAScript)
Constructs a basic regular expression from the sequence [__p, __p + char_traits<_Ch_type>::length(__p...
sub_match< wstring::const_iterator > wssub_match
Regex submatch over a standard wide string.
regex_token_iterator()
Default constructs a regex_token_iterator.
_GLIBCXX17_INLINE constexpr syntax_option_type optimize
A standard container which offers fixed time access to individual elements in any order...
basic_regex(const std::basic_string< _Ch_type, _Ch_traits, _Ch_alloc > &__s, flag_type __f=ECMAScript)
Constructs a basic regular expression from the string s interpreted according to the flags in f...
void swap(match_results< _Bi_iter, _Alloc > &__lhs, match_results< _Bi_iter, _Alloc > &__rhs) noexcept
Swaps two match results.
difference_type position(size_type __sub=0) const
Gets the offset of the beginning of the indicated submatch.
basic_regex & operator=(const _Ch_type *__p)
Replaces a regular expression with a new one constructed from a C-style null-terminated string...
_GLIBCXX17_INLINE constexpr match_flag_type format_default
Container class for localization functionality.The locale class is first a class wrapper for C librar...
_GLIBCXX17_INLINE constexpr syntax_option_type awk
regex_token_iterator & operator=(const regex_token_iterator &__rhs)
Assigns a regex_token_iterator to another.
_GLIBCXX_NODISCARD bool empty() const noexcept
Indicates if the match_results contains no results.
const value_type & operator*() const noexcept
Dereferences a regex_iterator.
ISO C++ entities toplevel namespace is std.
regex_token_iterator & operator++()
Increments a regex_token_iterator.
regex_token_iterator< const char * > cregex_token_iterator
Token iterator for C-style NULL-terminated strings.
basic_regex & assign(const _Ch_type *__p, std::size_t __len, flag_type __flags)
Assigns a new regular expression to a regex object from a C-style string containing a regular express...
Forward iterators support a superset of input iterator operations.
basic_regex(initializer_list< _Ch_type > __l, flag_type __f=ECMAScript)
Constructs a basic regular expression from an initializer list.
Properties of fundamental types.
sub_match< string::const_iterator > ssub_match
Standard regex submatch over a standard string.
_GLIBCXX17_INLINE constexpr syntax_option_type nosubs
regex_token_iterator< string::const_iterator > sregex_token_iterator
Token iterator for standard strings.
allocator_type get_allocator() const noexcept
Gets a copy of the allocator.
Takes a regex and an input string and does the matching.
match_results(const _Alloc &__a) noexcept
Constructs a default match_results container.
bool ready() const noexcept
Indicates if the match_results is ready.
_Out_iter regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, const basic_regex< _Ch_type, _Rx_traits > &__e, const basic_string< _Ch_type, _St, _Sa > &__fmt, regex_constants::match_flag_type __flags=regex_constants::match_default)
Search for a regular expression within a range for multiple times, and replace the matched parts thro...
match_results()
Constructs a default match_results container.
int compare(const value_type *__s) const
Compares this sub_match to a string.
regex_token_iterator operator++(int)
Postincrements a regex_token_iterator.
syntax_option_type
This is a bitmask type indicating how to interpret the regex.
basic_regex & assign(_InputIterator __first, _InputIterator __last, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
_GLIBCXX17_INLINE constexpr syntax_option_type grep
const_iterator end() const noexcept
Gets an iterator to one-past-the-end of the collection.
bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
A smart pointer with reference-counted copy semantics.
regex_traits()
Constructs a default traits object.
basic_regex & assign(const _Ch_type *__p, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object from a C-style null-terminated string containing a...
typename _Size< _Alloc, difference_type >::type size_type
The allocator's size type.
bool operator!=(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2) noexcept
Compares two match_results for inequality.
basic_regex & operator=(const basic_regex &__rhs)
Assigns one regular expression to another.
const _CharT * data() const noexcept
Return const pointer to contents.
static std::size_t length(const char_type *__p)
Gives the length of a C-style string starting at __p.
void swap(vector &__x) noexcept
Swaps data with another vector.
_Out_iter format(_Out_iter __out, const char_type *__fmt_first, const char_type *__fmt_last, match_flag_type __flags=regex_constants::format_default) const
bool regex_search(_Bi_iter __s, _Bi_iter __e, match_results< _Bi_iter, _Alloc > &__m, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
sub_match< const char * > csub_match
Standard regex submatch over a C-style null-terminated string.
~basic_regex()
Destroys a basic regular expression.
_BiIter first
second_type is the second bound type
_GLIBCXX17_INLINE constexpr syntax_option_type extended
Facet for localized string comparison.
int compare(const string_type &__s) const
Compares this sub_match to a string.
basic_regex & operator=(initializer_list< _Ch_type > __l)
Replaces a regular expression with a new one constructed from an initializer list.
bool regex_match(_Bi_iter __s, _Bi_iter __e, match_results< _Bi_iter, _Alloc > &__m, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
Determines if there is a match between the regular expression e and all of the character sequence [fi...
void swap(basic_regex &__rhs)
Swaps the contents of two regular expression objects.
basic_string< char_type, _St, _Sa > format(const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
size_type max_size() const noexcept
Gets the number of matches and submatches.
match_flag_type
This is a bitmask type indicating regex matching rules.
size_type size() const noexcept
const value_type * operator->() const
Selects a regex_token_iterator member.
locale_type imbue(locale_type __loc)
Imbues the regular expression object with the given locale.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
locale_type imbue(locale_type __loc)
Imbues the regex_traits object with a copy of a new locale.
basic_regex & operator=(basic_regex &&__rhs) noexcept
Move-assigns one regular expression to another.
difference_type length() const noexcept
Gets the length of the matching sequence.
_GLIBCXX17_INLINE constexpr match_flag_type match_default
bitset< _Nb > operator &(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
char_type translate(char_type __c) const
Performs the identity translation.
_GLIBCXX_NODISCARD bool empty() const noexcept
size_type max_size() const noexcept
regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, int __submatch=0, regex_constants::match_flag_type __m=regex_constants::match_default)
int compare(const sub_match &__s) const
Compares this and another matched sequence.
locale_type getloc() const
Gets a copy of the current locale in use by the regex_traits object.
regex_iterator & operator=(const regex_iterator &)=default
Copy assigns one regex_iterator to another.
regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, initializer_list< int > __submatches, regex_constants::match_flag_type __m=regex_constants::match_default)
unsigned int mark_count() const
Gets the number of marked subexpressions within the regular expression.
iterator begin() noexcept
string_type str() const
Gets the matching sequence as a string.
back_insert_iterator< _Container > back_inserter(_Container &__x)
_GLIBCXX17_INLINE constexpr syntax_option_type icase
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
bool operator==(const regex_iterator &) const noexcept
Tests the equivalence of two regex iterators.
const value_type * operator->() const noexcept
Selects a regex_iterator member.
bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)
basic_regex & assign(basic_regex &&__rhs) noexcept
The move-assignment operator.
bool operator==(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for equality.
sub_match< const wchar_t * > wcsub_match
Regex submatch over a C-style null-terminated wide string.
basic_regex & assign(const basic_string< _Ch_type, _Ch_traits, _Alloc > &__s, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object from a string containing a regular expression patt...
const value_type & operator*() const
Dereferences a regex_token_iterator.
basic_regex & assign(initializer_list< _Ch_type > __l, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
basic_regex< char > regex
Standard regular expressions.
void swap(match_results &__that) noexcept
Swaps the contents of two match_results.
regex_token_iterator< wstring::const_iterator > wsregex_token_iterator
Token iterator for standard wide-character strings.
regex_iterator operator++(int)
Postincrements a regex_iterator.
basic_regex(const _Ch_type *__p, std::size_t __len, flag_type __f=ECMAScript)
Constructs a basic regular expression from the sequence [p, p + len) interpreted according to the fla...
static constexpr _Tp min() noexcept
void resize(size_type __new_size)
Resizes the vector to the specified number of elements.
regex_token_iterator< const wchar_t * > wcregex_token_iterator
Token iterator for C-style NULL-terminated wide strings.
_GLIBCXX17_INLINE constexpr syntax_option_type collate
int value(_Ch_type __ch, int __radix) const
Converts a digit to an int.
const_iterator cend() const noexcept
Gets an iterator to one-past-the-end of the collection.
regex_token_iterator(const regex_token_iterator &__rhs)
Copy constructs a regex_token_iterator.
string_type transform(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence.
_GLIBCXX14_CONSTEXPR const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
char_class_type lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase=false) const
Maps one or more characters to a named character classification.
The results of a match or search operation.
basic_regex(_FwdIter __first, _FwdIter __last, flag_type __f=ECMAScript)
Constructs a basic regular expression from the range [first, last) interpreted according to the flags...
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
Gets a collation element by name.
const_reference operator[](size_type __sub) const
Gets a sub_match reference for the match or submatch.
const_iterator cbegin() const noexcept
Gets an iterator to the start of the sub_match collection.
regex_iterator()=default
Provides a singular iterator, useful for indicating one-past-the-end of a range.
Primary class template ctype facet.This template class defines classification and conversion function...
Basis for explicit traits specializations.
static constexpr _Tp max() noexcept
size_type size() const noexcept
Gets the number of matches and submatches.
string_type str(size_type __sub=0) const
Gets the match or submatch converted to a string type.
string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence, independent of case.
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
locale_type getloc() const
Gets the locale currently imbued in the regular expression object.
_GLIBCXX17_INLINE constexpr syntax_option_type ECMAScript
basic_regex & assign(const basic_regex &__rhs)
the real assignment operator.
bool operator==(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2) noexcept
Compares two match_results for equality.
regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, const std::vector< int > &__submatches, regex_constants::match_flag_type __m=regex_constants::match_default)
Managing sequences of characters and character-like objects.
Struct holding two objects of arbitrary type.
_Out_iter format(_Out_iter __out, const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
_Iterator __base(_Iterator __it)
const_reference suffix() const
Gets a sub_match representing the match suffix.
regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, const int(&__submatches)[_Nm], regex_constants::match_flag_type __m=regex_constants::match_default)
regex_iterator & operator++()
Increments a regex_iterator.
bool operator!=(const regex_iterator &__rhs) const noexcept
Tests the inequivalence of two regex iterators.
bool operator!=(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for inequality.
string_type format(const char_type *__fmt, match_flag_type __flags=regex_constants::format_default) const
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
flag_type flags() const
Gets the flags used to construct the regular expression or in the last call to assign().
_GLIBCXX17_INLINE constexpr syntax_option_type egrep
bool isctype(_Ch_type __c, char_class_type __f) const
Determines if c is a member of an identified class.
_GLIBCXX17_INLINE constexpr syntax_option_type basic
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
basic_regex< wchar_t > wregex
Standard wide-character regular expressions.
char_type translate_nocase(char_type __c) const
Translates a character into a case-insensitive equivalent.