31 namespace std _GLIBCXX_VISIBILITY(default)
33 _GLIBCXX_BEGIN_NAMESPACE_VERSION
34 _GLIBCXX_BEGIN_NAMESPACE_CXX11
35 template<
typename,
typename>
38 template<
typename _Bi_iter,
typename _Alloc>
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>
50 __regex_algo_impl(_BiIter __s, _BiIter __e,
51 match_results<_BiIter, _Alloc>& __m,
52 const basic_regex<_CharT, _TraitsT>& __re,
54 _RegexExecutorPolicy __policy,
57 template<
typename,
typename,
typename,
bool>
60 template<
typename _Tp>
63 template<
typename _Tp>
64 struct __is_contiguous_iter<_Tp*> :
true_type { };
66 template<
typename _Tp,
typename _Cont>
67 struct __is_contiguous_iter<
__gnu_cxx::__normal_iterator<_Tp*, _Cont>>
71 _GLIBCXX_BEGIN_NAMESPACE_CXX11
88 template<
typename _Ch_type>
92 typedef _Ch_type char_type;
99 typedef std::ctype_base::mask _BaseType;
101 unsigned char _M_extended;
102 static constexpr
unsigned char _S_under = 1 << 0;
103 static constexpr
unsigned char _S_valid_mask = 0x1;
105 constexpr _RegexMask(_BaseType
__base = 0,
106 unsigned char __extended = 0)
107 : _M_base(
__base), _M_extended(__extended)
113 return _RegexMask(_M_base & __other._M_base,
114 _M_extended & __other._M_extended);
120 return _RegexMask(_M_base | __other._M_base,
121 _M_extended | __other._M_extended);
127 return _RegexMask(_M_base ^ __other._M_base,
128 _M_extended ^ __other._M_extended);
133 {
return _RegexMask(~_M_base, ~_M_extended); }
136 operator&=(_RegexMask __other)
137 {
return *
this = (*this) & __other; }
140 operator|=(_RegexMask __other)
141 {
return *
this = (*this) | __other; }
144 operator^=(_RegexMask __other)
145 {
return *
this = (*this) ^ __other; }
148 operator==(_RegexMask __other)
const
150 return (_M_extended & _S_valid_mask)
151 == (__other._M_extended & _S_valid_mask)
152 && _M_base == __other._M_base;
155 #if __cpp_impl_three_way_comparison < 201907L
157 operator!=(_RegexMask __other)
const
158 {
return !((*this) == __other); }
163 typedef _RegexMask char_class_type;
183 {
return string_type::traits_type::length(__p); }
209 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
210 return __fctyp.tolower(__c);
233 template<
typename _Fwd_iter>
238 const __collate_type& __fclt(use_facet<__collate_type>(_M_locale));
240 return __fclt.transform(__s.
data(), __s.
data() + __s.
size());
257 template<
typename _Fwd_iter>
268 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
269 _GLIBCXX_STD_C::vector<char_type> __s(__first, __last);
270 __fctyp.tolower(__s.data(), __s.data() + __s.size());
271 return this->
transform(__s.data(), __s.data() + __s.size());
285 template<
typename _Fwd_iter>
326 template<
typename _Fwd_iter>
329 bool __icase =
false)
const;
344 isctype(_Ch_type __c, char_class_type __f)
const;
357 value(_Ch_type __ch,
int __radix)
const;
383 {
return _M_locale; }
386 locale_type _M_locale;
397 template<
typename _Ch_type,
typename _Rx_traits = regex_traits<_Ch_type>>
402 "regex traits class must have the same char_type");
405 typedef _Ch_type value_type;
406 typedef _Rx_traits traits_type;
407 typedef typename traits_type::string_type string_type;
409 typedef typename traits_type::locale_type locale_type;
426 #if __cplusplus >= 201703L || !defined __STRICT_ANSI__
437 : _M_flags(ECMAScript), _M_loc(), _M_automaton(
nullptr)
453 { _M_compile(__p, __p + _Rx_traits::length(__p), __f); }
470 __glibcxx_requires_string_len(__p, __len);
471 _M_compile(__p, __p + __len, __f);
497 template<
typename _Ch_traits,
typename _Ch_alloc>
502 { _M_compile(__s.data(), __s.data() + __s.size(), __f); }
517 template<
typename _FwdIter>
520 { this->
assign(__first, __last, __f); }
531 { _M_compile(__l.begin(), __l.end(), __f); }
560 {
return this->
assign(__p); }
572 {
return this->
assign(__l); }
580 template<
typename _Ch_traits,
typename _Alloc>
583 {
return this->
assign(__s); }
593 {
return *
this = __rhs; }
620 _M_compile(__p, __p + _Rx_traits::length(__p), __flags);
642 _M_compile(__p, __p + __len, __flags);
657 template<
typename _Ch_traits,
typename _Alloc>
662 _M_compile(__s.
data(), __s.
data() + __s.
size(), __flags);
679 template<
typename _InputIterator>
681 assign(_InputIterator __first, _InputIterator __last,
684 #if __cpp_if_constexpr >= 201606L
686 if constexpr (__detail::__is_contiguous_iter<_InputIterator>::value
687 && is_same_v<_ValT, value_type>)
689 __glibcxx_requires_valid_range(__first, __last);
690 if constexpr (is_pointer_v<_InputIterator>)
691 _M_compile(__first, __last, __flags);
693 _M_compile(__first.base(), __last.base(), __flags);
697 this->
assign(string_type(__first, __last), __flags);
715 _M_compile(__l.begin(), __l.end(), __flags);
728 return _M_automaton->_M_sub_count() - 1;
750 _M_automaton.reset();
773 std::swap(_M_automaton, __rhs._M_automaton);
776 #ifdef _GLIBCXX_DEBUG
779 { _M_automaton->_M_dot(__ostr); }
786 _M_compile(
const _Ch_type* __first,
const _Ch_type* __last,
789 __detail::_Compiler<_Rx_traits> __c(__first, __last, _M_loc, __f);
790 _M_automaton = __c._M_get_nfa();
794 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp>
796 __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
797 const basic_regex<_Cp, _Rp>&,
799 __detail::_RegexExecutorPolicy,
bool);
801 template<
typename,
typename,
typename,
bool>
802 friend class __detail::_Executor;
806 _AutomatonPtr _M_automaton;
809 #if ! __cpp_inline_variables
810 template<
typename _Ch,
typename _Tr>
814 template<
typename _Ch,
typename _Tr>
818 template<
typename _Ch,
typename _Tr>
822 template<
typename _Ch,
typename _Tr>
826 template<
typename _Ch,
typename _Tr>
830 template<
typename _Ch,
typename _Tr>
834 template<
typename _Ch,
typename _Tr>
838 template<
typename _Ch,
typename _Tr>
842 template<
typename _Ch,
typename _Tr>
846 template<
typename _Ch,
typename _Tr>
851 #if __cpp_deduction_guides >= 201606
852 template<
typename _ForwardIterator>
853 basic_regex(_ForwardIterator, _ForwardIterator,
855 -> basic_regex<
typename iterator_traits<_ForwardIterator>::value_type>;
861 #ifdef _GLIBCXX_USE_WCHAR_T
874 template<
typename _Ch_type,
typename _Rx_traits>
878 { __lhs.swap(__rhs); }
894 template<
typename _BiIter>
900 typedef typename __iter_traits::value_type value_type;
901 typedef typename __iter_traits::difference_type difference_type;
902 typedef _BiIter iterator;
907 constexpr
sub_match() noexcept : matched() { }
924 operator string_type()
const
951 {
return this->_M_str().compare(__s._M_str()); }
965 {
return this->_M_str().compare(__s); }
969 {
return this->_M_str().compare(__s); }
975 _M_compare(
const value_type* __s,
size_t __n)
const
976 {
return this->_M_str().compare({__s, __n}); }
983 using traits_type =
typename string_type::traits_type;
985 __string_view() =
default;
987 __string_view(
const value_type* __s,
size_t __n) noexcept
988 : _M_data(__s), _M_len(__n) { }
990 __string_view(
const value_type* __s) noexcept
991 : _M_data(__s), _M_len(traits_type::length(__s)) { }
993 __string_view(
const string_type& __s) noexcept
994 : _M_data(__s.data()), _M_len(__s.length()) { }
997 compare(__string_view __s)
const noexcept
999 if (
const size_t __n =
std::min(_M_len, __s._M_len))
1000 if (
int __ret = traits_type::compare(_M_data, __s._M_data, __n))
1003 const difference_type __diff = _M_len - __s._M_len;
1004 if (__diff > __limits::__max)
1005 return __limits::__max;
1006 if (__diff < __limits::__min)
1007 return __limits::__min;
1008 return static_cast<int>(__diff);
1012 const value_type* _M_data =
nullptr;
1017 template<
typename _Iter = _BiIter>
1018 __enable_if_t<__detail::__is_contiguous_iter<_Iter>::value,
1020 _M_str() const noexcept
1029 template<
typename _Iter = _BiIter>
1030 __enable_if_t<!__detail::__is_contiguous_iter<_Iter>::value,
1043 #ifdef _GLIBCXX_USE_WCHAR_T
1061 template<
typename _BiIter>
1064 {
return __lhs.
compare(__rhs) == 0; }
1066 #if __cpp_lib_three_way_comparison
1074 template<
typename _BiIter>
1078 noexcept(__detail::__is_contiguous_iter<_BiIter>::value)
1081 return __detail::__char_traits_cmp_cat<_Tr>(__lhs.compare(__rhs));
1090 template<
typename _BiIter>
1093 {
return __lhs.
compare(__rhs) != 0; }
1101 template<
typename _BiIter>
1104 {
return __lhs.
compare(__rhs) < 0; }
1112 template<
typename _BiIter>
1115 {
return __lhs.
compare(__rhs) <= 0; }
1123 template<
typename _BiIter>
1126 {
return __lhs.
compare(__rhs) >= 0; }
1134 template<
typename _BiIter>
1137 {
return __lhs.
compare(__rhs) > 0; }
1143 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1146 _Ch_traits, _Ch_alloc>;
1149 #if ! __cpp_lib_three_way_comparison
1157 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1159 operator==(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1161 {
return __rhs._M_compare(__lhs.data(), __lhs.size()) == 0; }
1170 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1172 operator!=(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1174 {
return !(__lhs == __rhs); }
1182 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1184 operator<(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1186 {
return __rhs._M_compare(__lhs.data(), __lhs.size()) > 0; }
1194 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1196 operator>(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1198 {
return __rhs < __lhs; }
1206 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1208 operator>=(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1210 {
return !(__lhs < __rhs); }
1218 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1220 operator<=(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1222 {
return !(__rhs < __lhs); }
1232 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1235 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1236 {
return __lhs._M_compare(__rhs.data(), __rhs.size()) == 0; }
1238 #if __cpp_lib_three_way_comparison
1246 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Alloc>
1249 const __sub_match_string<_Bi_iter, _Ch_traits, _Alloc>& __rhs)
1250 noexcept(__detail::__is_contiguous_iter<_Bi_iter>::value)
1252 return __detail::__char_traits_cmp_cat<_Ch_traits>(
1253 __lhs._M_compare(__rhs.data(), __rhs.size()));
1263 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1266 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1267 {
return !(__lhs == __rhs); }
1275 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1278 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1279 {
return __lhs._M_compare(__rhs.data(), __rhs.size()) < 0; }
1287 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1290 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1291 {
return __rhs < __lhs; }
1299 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1302 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1303 {
return !(__lhs < __rhs); }
1311 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1314 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1315 {
return !(__rhs < __lhs); }
1324 template<
typename _Bi_iter>
1328 {
return __rhs.
compare(__lhs) == 0; }
1337 template<
typename _Bi_iter>
1341 {
return !(__lhs == __rhs); }
1349 template<
typename _Bi_iter>
1353 {
return __rhs.
compare(__lhs) > 0; }
1361 template<
typename _Bi_iter>
1365 {
return __rhs < __lhs; }
1373 template<
typename _Bi_iter>
1377 {
return !(__lhs < __rhs); }
1385 template<
typename _Bi_iter>
1389 {
return !(__rhs < __lhs); }
1399 template<
typename _Bi_iter>
1403 {
return __lhs.
compare(__rhs) == 0; }
1405 #if __cpp_lib_three_way_comparison
1414 template<
typename _Bi_iter>
1418 noexcept(__detail::__is_contiguous_iter<_Bi_iter>::value)
1421 return __detail::__char_traits_cmp_cat<_Tr>(__lhs.compare(__rhs));
1431 template<
typename _Bi_iter>
1435 {
return !(__lhs == __rhs); }
1443 template<
typename _Bi_iter>
1447 {
return __lhs.
compare(__rhs) < 0; }
1455 template<
typename _Bi_iter>
1459 {
return __rhs < __lhs; }
1467 template<
typename _Bi_iter>
1471 {
return !(__lhs < __rhs); }
1479 template<
typename _Bi_iter>
1483 {
return !(__rhs < __lhs); }
1492 template<
typename _Bi_iter>
1505 template<
typename _Bi_iter>
1509 {
return !(__lhs == __rhs); }
1518 template<
typename _Bi_iter>
1531 template<
typename _Bi_iter>
1535 {
return __rhs < __lhs; }
1544 template<
typename _Bi_iter>
1548 {
return !(__lhs < __rhs); }
1557 template<
typename _Bi_iter>
1561 {
return !(__rhs < __lhs); }
1571 template<
typename _Bi_iter>
1577 #if __cpp_lib_three_way_comparison
1587 template<
typename _Bi_iter>
1591 noexcept(__detail::__is_contiguous_iter<_Bi_iter>::value)
1594 return __detail::__char_traits_cmp_cat<_Tr>(
1605 template<
typename _Bi_iter>
1609 {
return !(__lhs == __rhs); }
1618 template<
typename _Bi_iter>
1631 template<
typename _Bi_iter>
1635 {
return __rhs < __lhs; }
1644 template<
typename _Bi_iter>
1648 {
return !(__lhs < __rhs); }
1657 template<
typename _Bi_iter>
1661 {
return !(__rhs < __lhs); }
1672 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1677 {
return __os << __m.
str(); }
1703 template<
typename _Bi_iter,
1704 typename _Alloc = allocator<sub_match<_Bi_iter> > >
1706 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1727 typedef _GLIBCXX_STD_C::vector<sub_match<_Bi_iter>, _Alloc>
_Unchecked;
1739 typedef typename _Base_type::const_iterator const_iterator;
1740 typedef const_iterator iterator;
1741 typedef typename __iter_traits::difference_type difference_type;
1743 typedef _Alloc allocator_type;
1744 typedef typename __iter_traits::value_type char_type;
1833 _GLIBCXX_NODISCARD
bool
1854 {
return (*
this)[__sub].length(); }
1881 str(size_type __sub = 0)
const
1898 __glibcxx_assert(
ready() );
1899 return __sub <
size()
1901 : _M_unmatched_sub();
1915 __glibcxx_assert(
ready() );
1916 return !
empty() ? _M_prefix() : _M_unmatched_sub();
1930 __glibcxx_assert(
ready() );
1931 return !
empty() ? _M_suffix() : _M_unmatched_sub();
1946 {
return this->
begin(); }
1960 {
return this->
end(); }
1977 template<
typename _Out_iter>
1979 format(_Out_iter __out,
const char_type* __fmt_first,
1980 const char_type* __fmt_last,
1986 template<
typename _Out_iter,
typename _St,
typename _Sa>
1998 template<
typename _St,
typename _Sa>
2052 swap(_M_begin, __that._M_begin);
2057 template<
typename,
typename,
typename>
2062 template<
typename,
typename,
typename,
bool>
2065 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp>
2070 __detail::_RegexExecutorPolicy,
bool);
2075 _M_resize(
unsigned int __size)
2080 _M_establish_failed_match(_Bi_iter __end)
2082 sub_match<_Bi_iter> __sm;
2083 __sm.first = __sm.second = __end;
2088 _M_unmatched_sub()
const
2091 sub_match<_Bi_iter>&
2099 sub_match<_Bi_iter>&
2107 sub_match<_Bi_iter>&
2111 _Bi_iter _M_begin {};
2115 typedef match_results<const char*> cmatch;
2116 typedef match_results<string::const_iterator> smatch;
2117 #ifdef _GLIBCXX_USE_WCHAR_T
2118 typedef match_results<const wchar_t*> wcmatch;
2119 typedef match_results<wstring::const_iterator> wsmatch;
2129 template<
typename _Bi_iter,
typename _Alloc>
2148 #if ! __cpp_lib_three_way_comparison
2154 template<
typename _Bi_iter,
class _Alloc>
2158 {
return !(__m1 == __m2); }
2169 template<
typename _Bi_iter,
typename _Alloc>
2173 { __lhs.swap(__rhs); }
2175 _GLIBCXX_END_NAMESPACE_CXX11
2198 template<
typename _Bi_iter,
typename _Alloc,
2199 typename _Ch_type,
typename _Rx_traits>
2208 return __detail::__regex_algo_impl(__s, __e, __m, __re, __flags,
2209 __detail::_RegexExecutorPolicy::_S_auto,
true);
2226 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2234 return regex_match(__first, __last, __what, __re, __flags);
2251 template<
typename _Ch_type,
typename _Alloc,
typename _Rx_traits>
2258 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2274 template<
typename _Ch_traits,
typename _Ch_alloc,
2275 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2279 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2288 template<
typename _Ch_traits,
typename _Ch_alloc,
2289 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2293 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2311 template<
typename _Ch_type,
class _Rx_traits>
2317 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2332 template<
typename _Ch_traits,
typename _Str_allocator,
2333 typename _Ch_type,
typename _Rx_traits>
2355 template<
typename _Bi_iter,
typename _Alloc,
2356 typename _Ch_type,
typename _Rx_traits>
2364 return __detail::__regex_algo_impl(__s, __e, __m, __re, __flags,
2365 __detail::_RegexExecutorPolicy::_S_auto,
false);
2379 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2387 return regex_search(__first, __last, __what, __re, __flags);
2402 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2409 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2421 template<
typename _Ch_type,
typename _Rx_traits>
2427 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2439 template<
typename _Ch_traits,
typename _String_allocator,
2440 typename _Ch_type,
typename _Rx_traits>
2443 _String_allocator>& __s,
2447 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2461 template<
typename _Ch_traits,
typename _Ch_alloc,
2462 typename _Alloc,
typename _Ch_type,
2463 typename _Rx_traits>
2467 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2476 template<
typename _Ch_traits,
typename _Ch_alloc,
2477 typename _Alloc,
typename _Ch_type,
2478 typename _Rx_traits>
2482 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2489 template<
typename _Out_iter,
typename _Bi_iter,
2490 typename _Rx_traits,
typename _Ch_type>
2494 const _Ch_type* __fmt,
size_t __len,
2510 template<
typename _Out_iter,
typename _Bi_iter,
2511 typename _Rx_traits,
typename _Ch_type,
2512 typename _St,
typename _Sa>
2521 __fmt.
length(), __flags);
2537 template<
typename _Out_iter,
typename _Bi_iter,
2538 typename _Rx_traits,
typename _Ch_type>
2542 const _Ch_type* __fmt,
2563 template<
typename _Rx_traits,
typename _Ch_type,
2564 typename _St,
typename _Sa,
typename _Fst,
typename _Fsa>
2565 inline basic_string<_Ch_type, _St, _Sa>
2574 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2589 template<
typename _Rx_traits,
typename _Ch_type,
2590 typename _St,
typename _Sa>
2591 inline basic_string<_Ch_type, _St, _Sa>
2594 const _Ch_type* __fmt,
2600 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2615 template<
typename _Rx_traits,
typename _Ch_type,
2616 typename _St,
typename _Sa>
2617 inline basic_string<_Ch_type>
2627 __e, __fmt, __flags);
2642 template<
typename _Rx_traits,
typename _Ch_type>
2643 inline basic_string<_Ch_type>
2646 const _Ch_type* __fmt,
2653 __e, __fmt, __flags);
2659 _GLIBCXX_BEGIN_NAMESPACE_CXX11
2666 template<
typename _Bi_iter,
2667 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2668 typename _Rx_traits = regex_traits<_Ch_type> >
2674 typedef std::ptrdiff_t difference_type;
2675 typedef const value_type* pointer;
2676 typedef const value_type& reference;
2695 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2697 if (!
regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags))
2727 {
return !(*
this == __rhs); }
2734 {
return _M_match; }
2741 {
return &_M_match; }
2761 _Bi_iter _M_begin {};
2763 const regex_type* _M_pregex =
nullptr;
2765 match_results<_Bi_iter> _M_match;
2768 typedef regex_iterator<const char*> cregex_iterator;
2769 typedef regex_iterator<string::const_iterator> sregex_iterator;
2770 #ifdef _GLIBCXX_USE_WCHAR_T
2771 typedef regex_iterator<const wchar_t*> wcregex_iterator;
2772 typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
2783 template<
typename _Bi_iter,
2784 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2785 typename _Rx_traits = regex_traits<_Ch_type> >
2791 typedef std::ptrdiff_t difference_type;
2805 : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr),
2830 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2831 { _M_init(__a, __b); }
2847 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2848 { _M_init(__a, __b); }
2864 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2865 { _M_init(__a, __b); }
2876 template<std::
size_t _Nm>
2879 const int (&__submatches)[_Nm],
2882 : _M_position(__a, __b, __re, __m),
2883 _M_subs(__submatches, __submatches + _Nm), _M_n(0)
2884 { _M_init(__a, __b); }
2899 template <std::
size_t _Nm>
2910 : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
2911 _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
2912 { _M_normalize_result(); }
2932 {
return !(*
this == __rhs); }
2939 {
return *_M_result; }
2946 {
return _M_result; }
2969 _M_init(_Bi_iter __a, _Bi_iter __b);
2972 _M_current_match()
const
2974 if (_M_subs[_M_n] == -1)
2975 return (*_M_position).prefix();
2977 return (*_M_position)[_M_subs[_M_n]];
2981 _M_end_of_seq()
const
2982 {
return _M_result ==
nullptr; }
2986 _M_normalize_result()
2988 if (_M_position != _Position())
2989 _M_result = &_M_current_match();
2991 _M_result = &_M_suffix;
2993 _M_result =
nullptr;
2996 _Position _M_position;
2998 value_type _M_suffix;
3000 const value_type* _M_result;
3012 #ifdef _GLIBCXX_USE_WCHAR_T
3022 _GLIBCXX_END_NAMESPACE_CXX11
3023 _GLIBCXX_END_NAMESPACE_VERSION
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
bool operator>=(typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a character and a regular expression submatch.
_Out_iter __regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, const basic_regex< _Ch_type, _Rx_traits > &__e, const _Ch_type *__fmt, size_t __len, regex_constants::match_flag_type __flags)
Determines if there is a match between the regular expression e and all of the character sequence [fi...
sub_match< wstring::const_iterator > wssub_match
Regex submatch over a standard wide string.
bool operator!=(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
Tests the inequivalence of a regular expression submatch and a character.
sub_match< string::const_iterator > ssub_match
Standard regex submatch over a standard string.
bool operator==(const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the equivalence of a string and a regular expression submatch.
bool operator!=(const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the inequivalence of a string and a regular expression submatch.
sub_match< const char * > csub_match
Standard regex submatch over a C-style null-terminated string.
regex_token_iterator< const char * > cregex_token_iterator
Token iterator for C-style NULL-terminated strings.
bool operator==(const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__rhs)
Tests the equivalence of a regular expression submatch and a string.
bool operator>=(const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a string and a regular expression submatch.
regex_token_iterator< wstring::const_iterator > wsregex_token_iterator
Token iterator for standard wide-character strings.
bool operator==(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
Tests the equivalence of a regular expression submatch and a character.
bool operator>=(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
Tests the ordering of a regular expression submatch and a C string.
bool operator==(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
Tests the equivalence of a regular expression submatch and a C string.
bool operator!=(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
Tests the inequivalence of a regular expression submatch and a string.
bool operator!=(typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the inequivalence of a C string and a regular expression submatch.
regex_token_iterator< const wchar_t * > wcregex_token_iterator
Token iterator for C-style NULL-terminated wide strings.
void swap(basic_regex< _Ch_type, _Rx_traits > &__lhs, basic_regex< _Ch_type, _Rx_traits > &__rhs) noexcept
Swaps the contents of two regular expression objects.
bool operator>(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
Tests the ordering of a regular expression submatch and a character.
bool operator>(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
Tests the ordering of a regular expression submatch and a C string.
bool operator>=(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
Tests the ordering of a regular expression submatch and a character.
bool operator>(typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a character and a regular expression submatch.
basic_regex< char > regex
Standard regular expressions.
_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...
sub_match< const wchar_t * > wcsub_match
Regex submatch over a C-style null-terminated wide string.
regex_token_iterator< string::const_iterator > sregex_token_iterator
Token iterator for standard strings.
bool operator>=(const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__rhs)
Tests the ordering of a regular expression submatch and a string.
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...
bool operator==(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for equality.
bool operator!=(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for inequality.
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)
bool operator>(const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__rhs)
Tests the ordering of a regular expression submatch and a string.
bool operator>(typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a C string and a regular expression submatch.
bool operator>=(const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
Tests the ordering of two regular expression submatches.
bool operator>(const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
Tests the ordering of two regular expression submatches.
bool operator==(typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the equivalence of a character and a regular expression submatch.
bool operator>(const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a string and a regular expression submatch.
bool operator!=(typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the inequivalence of a character and a regular expression submatch.
basic_regex< wchar_t > wregex
Standard wide-character regular expressions.
bool operator==(typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the equivalence of a C string and a regular expression submatch.
bool operator==(const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
Tests the equivalence of two regular expression submatches.
bool operator!=(const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
Tests the inequivalence of two regular expression submatches.
bool operator!=(const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__rhs)
Tests the inequivalence of a regular expression submatch and a string.
bool operator>=(typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a C string and a regular expression submatch.
constexpr back_insert_iterator< _Container > back_inserter(_Container &__x)
ISO C++ entities toplevel namespace is std.
bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
bitset< _Nb > operator&(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
GNU extensions for public use.
__numeric_traits_integer< _Tp > __int_traits
Convenience alias for __numeric_traits<integer-type>.
constexpr _Iterator __base(_Iterator __it)
constexpr syntax_option_type collate
constexpr syntax_option_type ECMAScript
constexpr syntax_option_type egrep
syntax_option_type
This is a bitmask type indicating how to interpret the regex.
constexpr syntax_option_type multiline
constexpr match_flag_type match_default
constexpr syntax_option_type awk
constexpr syntax_option_type extended
constexpr syntax_option_type basic
match_flag_type
This is a bitmask type indicating regex matching rules.
constexpr syntax_option_type icase
constexpr syntax_option_type optimize
constexpr match_flag_type format_default
constexpr syntax_option_type nosubs
constexpr syntax_option_type grep
typename _Size< _Alloc, difference_type >::type size_type
The allocator's size type.
Basis for explicit traits specializations.
Managing sequences of characters and character-like objects.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
size_type length() const noexcept
Returns the number of characters in the string, not including any null-termination.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
const _CharT * data() const noexcept
Return const pointer to contents.
Traits class for iterators.
Container class for localization functionality.
Facet for localized string comparison.
Primary class template ctype facet.
locale_type getloc() const noexcept
Gets the locale currently imbued in the regular expression object.
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...
basic_regex & assign(basic_regex &&__rhs) noexcept
Move-assigns one regular expression to another.
unsigned int mark_count() const noexcept
Gets the number of marked subexpressions within the regular expression.
basic_regex & assign(initializer_list< _Ch_type > __l, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
locale_type imbue(locale_type __loc)
Imbues the regular expression object with the given locale.
basic_regex(const basic_regex &__rhs)=default
Copy-constructs a basic regular expression.
flag_type flags() const noexcept
Gets the flags used to construct the regular expression or in the last call to assign().
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...
void swap(basic_regex &__rhs) noexcept
Swaps the contents of two regular expression objects.
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.
basic_regex & operator=(const _Ch_type *__p)
Replaces a regular expression with a new one constructed from a C-style null-terminated string.
basic_regex & operator=(const basic_regex &)=default
Assigns one regular expression to another.
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...
basic_regex & assign(const basic_regex &__rhs) noexcept
Assigns one regular expression to another.
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...
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...
basic_regex & assign(_InputIterator __first, _InputIterator __last, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
basic_regex & operator=(basic_regex &&)=default
Move-assigns one regular expression to another.
basic_regex & assign(const _Ch_type *__p, size_t __len, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object from a C-style string containing a regular express...
basic_regex(basic_regex &&__rhs) noexcept=default
Move-constructs a basic regular expression.
basic_regex(initializer_list< _Ch_type > __l, flag_type __f=ECMAScript)
Constructs a basic regular expression from an initializer list.
basic_regex & operator=(initializer_list< _Ch_type > __l)
Replaces a regular expression with a new one constructed from an initializer list.
~basic_regex()
Destroys a basic regular expression.
The results of a match or search operation.
allocator_type get_allocator() const noexcept
Gets a copy of the allocator.
void swap(match_results &__that) noexcept
Swaps the contents of two match_results.
difference_type position(size_type __sub=0) const
Gets the offset of the beginning of the indicated submatch.
size_type size() const noexcept
Gets the number of matches and submatches.
_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
difference_type length(size_type __sub=0) const
Gets the length of the indicated submatch.
const_reference prefix() const
Gets a sub_match representing the match prefix.
size_type max_size() const noexcept
Gets the number of matches and submatches.
const_reference operator[](size_type __sub) const
Gets a sub_match reference for the match or submatch.
match_results(match_results &&) noexcept=default
Move constructs a match_results.
basic_string< char_type, _St, _Sa > format(const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
match_results(const _Alloc &__a) noexcept
Constructs a default match_results container.
match_results(const match_results &)=default
Copy constructs a match_results.
_Out_iter format(_Out_iter __out, const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
const_iterator cbegin() const noexcept
Gets an iterator to the start of the sub_match collection.
string_type str(size_type __sub=0) const
Gets the match or submatch converted to a string type.
const_iterator end() const noexcept
Gets an iterator to one-past-the-end of the collection.
const_reference suffix() const
Gets a sub_match representing the match suffix.
bool ready() const noexcept
Indicates if the match_results is ready.
bool empty() const noexcept
Indicates if the match_results contains no results.
string_type format(const char_type *__fmt, match_flag_type __flags=regex_constants::format_default) const
match_results()
Constructs a default match_results container.
const_iterator cend() const noexcept
Gets an iterator to one-past-the-end of the collection.
const_iterator begin() const noexcept
Gets an iterator to the start of the sub_match collection.
Takes a regex and an input string and does the matching.
Describes aspects of a regular expression.
char_type translate(char_type __c) const
Performs the identity translation.
string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
Gets a collation element by name.
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.
static std::size_t length(const char_type *__p)
Gives the length of a C-style string starting at __p.
string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence, independent of case.
regex_traits()
Constructs a default traits object.
int value(_Ch_type __ch, int __radix) const
Converts a digit to an int.
char_type translate_nocase(char_type __c) const
Translates a character into a case-insensitive equivalent.
locale_type getloc() const
Gets a copy of the current locale in use by the regex_traits object.
bool isctype(_Ch_type __c, char_class_type __f) const
Determines if c is a member of an identified class.
locale_type imbue(locale_type __loc)
Imbues the regex_traits object with a copy of a new locale.
string_type transform(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence.
difference_type length() const noexcept
Gets the length of the matching sequence.
int compare(const value_type *__s) const
Compares this sub_match to a string.
string_type str() const
Gets the matching sequence as a string.
int compare(const sub_match &__s) const
Compares this and another matched sequence.
int compare(const string_type &__s) const
Compares this sub_match to a string.
regex_iterator & operator++()
Increments a regex_iterator.
bool operator!=(const regex_iterator &__rhs) const noexcept
Tests the inequivalence of two regex iterators.
regex_iterator operator++(int)
Postincrements a regex_iterator.
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)
regex_iterator(const regex_iterator &)=default
Copy constructs a regex_iterator.
regex_iterator()=default
Provides a singular iterator, useful for indicating one-past-the-end of a range.
regex_iterator & operator=(const regex_iterator &)=default
Copy assigns one regex_iterator to another.
const value_type & operator*() const noexcept
Dereferences a regex_iterator.
const value_type * operator->() const noexcept
Selects a regex_iterator member.
bool operator==(const regex_iterator &) const noexcept
Tests the equivalence of two regex iterators.
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)
bool operator==(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for equality.
const value_type & operator*() const
Dereferences a regex_token_iterator.
regex_token_iterator(const regex_token_iterator &__rhs)
Copy constructs a regex_token_iterator.
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)
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)
regex_token_iterator & operator++()
Increments a regex_token_iterator.
bool operator!=(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for inequality.
regex_token_iterator operator++(int)
Postincrements a regex_token_iterator.
regex_token_iterator()
Default constructs a regex_token_iterator.
regex_token_iterator & operator=(const regex_token_iterator &__rhs)
Assigns a regex_token_iterator to another.
const value_type * operator->() const
Selects a regex_token_iterator member.
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)
A smart pointer with reference-counted copy semantics.
Struct holding two objects of arbitrary type.
_BiIter first
The first member.
_BiIter second
The second member.
Forward iterators support a superset of input iterator operations.
A standard container which offers fixed time access to individual elements in any order.
constexpr iterator end() noexcept
constexpr iterator begin() noexcept
constexpr void assign(size_type __n, const value_type &__val)
Assigns a given value to a vector.
constexpr void swap(vector &__x) noexcept
Swaps data with another vector.
constexpr bool empty() const noexcept
constexpr allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
constexpr size_type size() const noexcept
constexpr reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
constexpr size_type max_size() const noexcept