31 namespace std _GLIBCXX_VISIBILITY(default)
33 _GLIBCXX_BEGIN_NAMESPACE_VERSION
34 template<
typename,
typename>
37 template<
typename,
typename>
40 _GLIBCXX_END_NAMESPACE_VERSION
44 _GLIBCXX_BEGIN_NAMESPACE_VERSION
46 enum class _RegexExecutorPolicy : int
47 { _S_auto, _S_alternate };
49 template<
typename _BiIter,
typename _Alloc,
50 typename _CharT,
typename _TraitsT,
51 _RegexExecutorPolicy __policy,
54 __regex_algo_impl(_BiIter __s,
60 template<
typename,
typename,
typename,
bool>
63 template<
typename _TraitsT>
65 __compile_nfa(
const typename _TraitsT::char_type* __first,
66 const typename _TraitsT::char_type* __last,
67 const _TraitsT& __traits,
70 _GLIBCXX_END_NAMESPACE_VERSION
73 _GLIBCXX_BEGIN_NAMESPACE_VERSION
90 template<
typename _Ch_type>
94 typedef _Ch_type char_type;
100 typedef typename std::ctype<char_type>::mask _BaseType;
102 unsigned char _M_extended;
103 static constexpr
unsigned char _S_under = 1 << 0;
106 static constexpr
unsigned char _S_blank = 1 << 1;
107 static constexpr
unsigned char _S_valid_mask = 0x3;
109 constexpr _RegexMask(_BaseType
__base = 0,
110 unsigned char __extended = 0)
111 : _M_base(
__base), _M_extended(__extended)
117 return _RegexMask(_M_base & __other._M_base,
118 _M_extended & __other._M_extended);
124 return _RegexMask(_M_base | __other._M_base,
125 _M_extended | __other._M_extended);
131 return _RegexMask(_M_base ^ __other._M_base,
132 _M_extended ^ __other._M_extended);
137 {
return _RegexMask(~_M_base, ~_M_extended); }
140 operator&=(_RegexMask __other)
141 {
return *
this = (*this) & __other; }
144 operator|=(_RegexMask __other)
145 {
return *
this = (*this) | __other; }
148 operator^=(_RegexMask __other)
149 {
return *
this = (*this) ^ __other; }
152 operator==(_RegexMask __other)
const
154 return (_M_extended & _S_valid_mask)
155 == (__other._M_extended & _S_valid_mask)
156 && _M_base == __other._M_base;
160 operator!=(_RegexMask __other)
const
161 {
return !((*this) == __other); }
165 typedef _RegexMask char_class_type;
185 {
return string_type::traits_type::length(__p); }
211 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
212 return __fctyp.tolower(__c);
235 template<
typename _Fwd_iter>
240 const __collate_type& __fclt(use_facet<__collate_type>(_M_locale));
242 return __fclt.transform(__s.
data(), __s.
data() + __s.
size());
259 template<
typename _Fwd_iter>
270 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
287 template<
typename _Fwd_iter>
328 template<
typename _Fwd_iter>
331 bool __icase =
false)
const;
346 isctype(_Ch_type __c, char_class_type __f)
const;
359 value(_Ch_type __ch,
int __radix)
const;
375 std::swap(_M_locale, __loc);
385 {
return _M_locale; }
388 locale_type _M_locale;
399 template<
typename _Ch_type,
typename _Rx_traits = regex_traits<_Ch_type>>
403 static_assert(is_same<_Ch_type, typename _Rx_traits::char_type>::value,
404 "regex traits class must have the same char_type");
407 typedef _Ch_type value_type;
408 typedef _Rx_traits traits_type;
409 typedef typename traits_type::string_type string_type;
411 typedef typename traits_type::locale_type locale_type;
436 : _M_flags(ECMAScript), _M_automaton(nullptr)
478 : _M_flags(__rhs._M_flags), _M_original_str(__rhs._M_original_str)
480 _M_traits.imbue(__rhs.getloc());
481 this->
assign(_M_original_str, _M_flags);
493 : _M_flags(__rhs._M_flags),
494 _M_original_str(std::move(__rhs._M_original_str))
496 _M_traits.imbue(__rhs.getloc());
497 this->
assign(_M_original_str, _M_flags);
498 __rhs._M_automaton.reset();
510 template<
typename _Ch_traits,
typename _Ch_alloc>
531 template<
typename _FwdIter>
535 _M_original_str(__first, __last),
536 _M_automaton(__detail::__compile_nfa(_M_original_str.c_str(),
537 _M_original_str.c_str()
538 + _M_original_str.
size(),
566 {
return this->
assign(__rhs); }
576 {
return this->
assign(std::move(__rhs)); }
587 {
return this->
assign(__p); }
599 {
return this->
assign(__l.begin(), __l.end()); }
607 template<
typename _Ch_typeraits,
typename _Alloc>
610 {
return this->
assign(__s); }
621 _M_flags = __rhs._M_flags;
622 _M_original_str = __rhs._M_original_str;
623 _M_traits.imbue(__rhs.getloc());
624 this->
assign(_M_original_str, _M_flags);
639 _M_flags = __rhs._M_flags;
640 _M_original_str = std::move(__rhs._M_original_str);
641 __rhs._M_automaton.reset();
642 _M_traits.imbue(__rhs.getloc());
643 this->
assign(_M_original_str, _M_flags);
662 {
return this->
assign(string_type(__p), __flags); }
679 {
return this->
assign(string_type(__p, __len), __flags); }
692 template<
typename _Ch_typeraits,
typename _Alloc>
697 _M_automaton = __detail::__compile_nfa(
698 __s.
data(), __s.
data() + __s.
size(), _M_traits, __flags);
699 _M_original_str = __s;
717 template<
typename _InputIterator>
719 assign(_InputIterator __first, _InputIterator __last,
721 {
return this->
assign(string_type(__first, __last), __flags); }
736 {
return this->
assign(__l.begin(), __l.end(), __flags); }
747 return _M_automaton->_M_sub_count() - 1;
768 _M_automaton.reset();
769 return _M_traits.imbue(__loc);
778 {
return _M_traits.getloc(); }
789 std::swap(_M_flags, __rhs._M_flags);
790 std::swap(_M_traits, __rhs._M_traits);
791 auto __tmp = std::move(_M_original_str);
792 this->
assign(__rhs._M_original_str, _M_flags);
793 __rhs.assign(__tmp, __rhs._M_flags);
796 #ifdef _GLIBCXX_DEBUG
799 { _M_automaton->_M_dot(__ostr); }
805 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
806 __detail::_RegexExecutorPolicy,
bool>
808 __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
809 const basic_regex<_Cp, _Rp>&,
812 template<
typename,
typename,
typename,
bool>
813 friend class __detail::_Executor;
816 _Rx_traits _M_traits;
817 basic_string<_Ch_type> _M_original_str;
818 _AutomatonPtr _M_automaton;
824 #ifdef _GLIBCXX_USE_WCHAR_T
836 template<
typename _Ch_type,
typename _Rx_traits>
840 { __lhs.swap(__rhs); }
856 template<
typename _BiIter>
859 typedef iterator_traits<_BiIter> __iter_traits;
862 typedef typename __iter_traits::value_type value_type;
863 typedef typename __iter_traits::difference_type difference_type;
864 typedef _BiIter iterator;
955 #ifdef _GLIBCXX_USE_WCHAR_T
971 template<
typename _BiIter>
974 {
return __lhs.
compare(__rhs) == 0; }
982 template<
typename _BiIter>
985 {
return __lhs.
compare(__rhs) != 0; }
993 template<
typename _BiIter>
996 {
return __lhs.
compare(__rhs) < 0; }
1004 template<
typename _BiIter>
1007 {
return __lhs.
compare(__rhs) <= 0; }
1015 template<
typename _BiIter>
1018 {
return __lhs.
compare(__rhs) >= 0; }
1026 template<
typename _BiIter>
1029 {
return __lhs.
compare(__rhs) > 0; }
1032 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1033 using __sub_match_string = basic_string<
1034 typename iterator_traits<_Bi_iter>::value_type,
1035 _Ch_traits, _Ch_alloc>;
1044 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1057 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1061 {
return !(__lhs == __rhs); }
1069 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1071 operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1073 {
return __rhs.
compare(__lhs.c_str()) > 0; }
1081 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1085 {
return __rhs < __lhs; }
1093 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1097 {
return !(__lhs < __rhs); }
1105 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1107 operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1109 {
return !(__rhs < __lhs); }
1118 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1131 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1135 {
return !(__lhs == __rhs); }
1143 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1145 operator<(const sub_match<_Bi_iter>& __lhs,
1147 {
return __lhs.
compare(__rhs.c_str()) < 0; }
1155 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1159 {
return __rhs < __lhs; }
1167 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1171 {
return !(__lhs < __rhs); }
1179 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1181 operator<=(const sub_match<_Bi_iter>& __lhs,
1183 {
return !(__rhs < __lhs); }
1192 template<
typename _Bi_iter>
1194 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1196 {
return __rhs.
compare(__lhs) == 0; }
1205 template<
typename _Bi_iter>
1207 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1209 {
return !(__lhs == __rhs); }
1217 template<
typename _Bi_iter>
1219 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1221 {
return __rhs.
compare(__lhs) > 0; }
1229 template<
typename _Bi_iter>
1231 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1233 {
return __rhs < __lhs; }
1241 template<
typename _Bi_iter>
1243 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1245 {
return !(__lhs < __rhs); }
1253 template<
typename _Bi_iter>
1255 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1257 {
return !(__rhs < __lhs); }
1266 template<
typename _Bi_iter>
1269 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1270 {
return __lhs.
compare(__rhs) == 0; }
1279 template<
typename _Bi_iter>
1282 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1283 {
return !(__lhs == __rhs); }
1291 template<
typename _Bi_iter>
1293 operator<(const sub_match<_Bi_iter>& __lhs,
1294 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1295 {
return __lhs.compare(__rhs) < 0; }
1303 template<
typename _Bi_iter>
1306 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1307 {
return __rhs < __lhs; }
1315 template<
typename _Bi_iter>
1318 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1319 {
return !(__lhs < __rhs); }
1327 template<
typename _Bi_iter>
1329 operator<=(const sub_match<_Bi_iter>& __lhs,
1330 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1331 {
return !(__rhs < __lhs); }
1340 template<
typename _Bi_iter>
1342 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1346 return __rhs.
compare(string_type(1, __lhs)) == 0;
1356 template<
typename _Bi_iter>
1358 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1360 {
return !(__lhs == __rhs); }
1368 template<
typename _Bi_iter>
1370 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1374 return __rhs.
compare(string_type(1, __lhs)) > 0;
1383 template<
typename _Bi_iter>
1385 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1387 {
return __rhs < __lhs; }
1395 template<
typename _Bi_iter>
1397 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1399 {
return !(__lhs < __rhs); }
1407 template<
typename _Bi_iter>
1409 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1411 {
return !(__rhs < __lhs); }
1420 template<
typename _Bi_iter>
1423 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1426 return __lhs.
compare(string_type(1, __rhs)) == 0;
1436 template<
typename _Bi_iter>
1439 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1440 {
return !(__lhs == __rhs); }
1448 template<
typename _Bi_iter>
1450 operator<(const sub_match<_Bi_iter>& __lhs,
1451 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1454 return __lhs.
compare(string_type(1, __rhs)) < 0;
1463 template<
typename _Bi_iter>
1466 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1467 {
return __rhs < __lhs; }
1475 template<
typename _Bi_iter>
1478 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1479 {
return !(__lhs < __rhs); }
1487 template<
typename _Bi_iter>
1489 operator<=(const sub_match<_Bi_iter>& __lhs,
1490 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1491 {
return !(__rhs < __lhs); }
1501 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1503 basic_ostream<_Ch_type, _Ch_traits>&
1504 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1506 {
return __os << __m.
str(); }
1513 template<
typename _Bi_iter>
1514 inline const sub_match<_Bi_iter>&
1517 static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>();
1543 template<
typename _Bi_iter,
1544 typename _Alloc = allocator<sub_match<_Bi_iter> > >
1546 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1561 typedef std::iterator_traits<_Bi_iter> __iter_traits;
1569 typedef sub_match<_Bi_iter> value_type;
1570 typedef const value_type& const_reference;
1571 typedef const_reference reference;
1572 typedef typename _Base_type::const_iterator const_iterator;
1573 typedef const_iterator iterator;
1574 typedef typename __iter_traits::difference_type difference_type;
1575 typedef typename allocator_traits<_Alloc>::size_type size_type;
1576 typedef _Alloc allocator_type;
1577 typedef typename __iter_traits::value_type char_type;
1652 return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0;
1666 {
return size() == 0; }
1685 {
return (*
this)[__sub].length(); }
1704 (*
this)[__sub].first) : -1;
1717 str(size_type __sub = 0)
const
1718 {
return (*
this)[__sub].str(); }
1734 _GLIBCXX_DEBUG_ASSERT(
ready() );
1735 return __sub <
size()
1737 : __unmatched_sub<_Bi_iter>();
1751 _GLIBCXX_DEBUG_ASSERT(
ready() );
1754 : __unmatched_sub<_Bi_iter>();
1768 _GLIBCXX_DEBUG_ASSERT(
ready() );
1771 : __unmatched_sub<_Bi_iter>();
1786 {
return this->
begin(); }
1800 {
return this->
end(); }
1817 template<
typename _Out_iter>
1819 format(_Out_iter __out,
const char_type* __fmt_first,
1820 const char_type* __fmt_last,
1826 template<
typename _Out_iter,
typename _St,
typename _Sa>
1838 template<
typename _St,
typename _Sa>
1875 {
return _Base_type::get_allocator(); }
1892 swap(_M_begin, __that._M_begin);
1897 template<
typename,
typename,
typename,
bool>
1900 template<
typename,
typename,
typename>
1903 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
1904 __detail::_RegexExecutorPolicy,
bool>
1911 bool _M_in_iterator;
1914 typedef match_results<const char*> cmatch;
1915 typedef match_results<string::const_iterator> smatch;
1916 #ifdef _GLIBCXX_USE_WCHAR_T
1917 typedef match_results<const wchar_t*> wcmatch;
1918 typedef match_results<wstring::const_iterator> wsmatch;
1927 template<
typename _Bi_iter,
typename _Alloc>
1932 if (__m1.ready() != __m2.ready())
1936 if (__m1.empty() != __m2.empty())
1940 return __m1.prefix() == __m2.prefix()
1941 && __m1.size() == __m2.size()
1942 &&
std::equal(__m1.begin(), __m1.end(), __m2.begin())
1943 && __m1.suffix() == __m2.suffix();
1951 template<
typename _Bi_iter,
class _Alloc>
1955 {
return !(__m1 == __m2); }
1965 template<
typename _Bi_iter,
typename _Alloc>
1969 { __lhs.swap(__rhs); }
1992 template<
typename _Bi_iter,
typename _Alloc,
1993 typename _Ch_type,
typename _Rx_traits>
2002 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2003 __detail::_RegexExecutorPolicy::_S_auto,
true>
2004 (__s, __e, __m, __re, __flags);
2021 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2029 return regex_match(__first, __last, __what, __re, __flags);
2046 template<
typename _Ch_type,
typename _Alloc,
typename _Rx_traits>
2053 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2069 template<
typename _Ch_traits,
typename _Ch_alloc,
2070 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2074 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2093 template<
typename _Ch_type,
class _Rx_traits>
2099 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2114 template<
typename _Ch_traits,
typename _Str_allocator,
2115 typename _Ch_type,
typename _Rx_traits>
2137 template<
typename _Bi_iter,
typename _Alloc,
2138 typename _Ch_type,
typename _Rx_traits>
2146 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2147 __detail::_RegexExecutorPolicy::_S_auto,
false>
2148 (__s, __e, __m, __re, __flags);
2162 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2170 return regex_search(__first, __last, __what, __re, __flags);
2185 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2192 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2204 template<
typename _Ch_type,
typename _Rx_traits>
2210 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2222 template<
typename _Ch_traits,
typename _String_allocator,
2223 typename _Ch_type,
typename _Rx_traits>
2226 _String_allocator>& __s,
2230 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2244 template<
typename _Ch_traits,
typename _Ch_alloc,
2245 typename _Alloc,
typename _Ch_type,
2246 typename _Rx_traits>
2250 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2270 template<
typename _Out_iter,
typename _Bi_iter,
2271 typename _Rx_traits,
typename _Ch_type,
2272 typename _St,
typename _Sa>
2296 template<
typename _Out_iter,
typename _Bi_iter,
2297 typename _Rx_traits,
typename _Ch_type>
2299 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
2300 const basic_regex<_Ch_type, _Rx_traits>& __e,
2301 const _Ch_type* __fmt,
2316 template<
typename _Rx_traits,
typename _Ch_type,
2317 typename _St,
typename _Sa,
typename _Fst,
typename _Fsa>
2318 inline basic_string<_Ch_type, _St, _Sa>
2327 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2342 template<
typename _Rx_traits,
typename _Ch_type,
2343 typename _St,
typename _Sa>
2344 inline basic_string<_Ch_type, _St, _Sa>
2347 const _Ch_type* __fmt,
2353 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2368 template<
typename _Rx_traits,
typename _Ch_type,
2369 typename _St,
typename _Sa>
2370 inline basic_string<_Ch_type>
2380 __e, __fmt, __flags);
2395 template<
typename _Rx_traits,
typename _Ch_type>
2396 inline basic_string<_Ch_type>
2399 const _Ch_type* __fmt,
2406 __e, __fmt, __flags);
2417 template<
typename _Bi_iter,
2418 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2419 typename _Rx_traits = regex_traits<_Ch_type> >
2425 typedef std::ptrdiff_t difference_type;
2448 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2450 if (!
regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags))
2476 {
return !(*
this == __rhs); }
2483 {
return _M_match; }
2490 {
return &_M_match; }
2512 const regex_type* _M_pregex;
2517 typedef regex_iterator<const char*> cregex_iterator;
2518 typedef regex_iterator<string::const_iterator> sregex_iterator;
2519 #ifdef _GLIBCXX_USE_WCHAR_T
2520 typedef regex_iterator<const wchar_t*> wcregex_iterator;
2521 typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
2532 template<
typename _Bi_iter,
2533 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2534 typename _Rx_traits = regex_traits<_Ch_type> >
2540 typedef std::ptrdiff_t difference_type;
2554 : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr),
2579 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2580 { _M_init(__a, __b); }
2596 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2597 { _M_init(__a, __b); }
2613 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2614 { _M_init(__a, __b); }
2625 template<std::
size_t _Nm>
2628 const int (&__submatches)[_Nm],
2631 : _M_position(__a, __b, __re, __m),
2632 _M_subs(__submatches, __submatches + _Nm), _M_n(0)
2633 { _M_init(__a, __b); }
2640 : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
2641 _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
2642 { _M_normalize_result(); }
2662 {
return !(*
this == __rhs); }
2669 {
return *_M_result; }
2676 {
return _M_result; }
2699 _M_init(_Bi_iter __a, _Bi_iter __b);
2702 _M_current_match()
const
2704 if (_M_subs[_M_n] == -1)
2705 return (*_M_position).prefix();
2707 return (*_M_position)[_M_subs[_M_n]];
2711 _M_end_of_seq()
const
2712 {
return _M_result ==
nullptr; }
2716 _M_normalize_result()
2718 if (_M_position != _Position())
2719 _M_result = &_M_current_match();
2721 _M_result = &_M_suffix;
2723 _M_result =
nullptr;
2726 _Position _M_position;
2728 value_type _M_suffix;
2730 const value_type* _M_result;
2742 #ifdef _GLIBCXX_USE_WCHAR_T
2751 _GLIBCXX_END_NAMESPACE_VERSION
string_type format(const char_type *__fmt, match_flag_type __flags=regex_constants::format_default) const
back_insert_iterator< _Container > back_inserter(_Container &__x)
constexpr size_t size() const noexcept
Returns the total number of bits.
bool operator==(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for equality.
bitset< _Nb > operator&(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
void swap(vector &__x) noexcept(_Alloc_traits::_S_nothrow_swap())
Swaps data with another vector.
Struct holding two objects of arbitrary type.
bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
unsigned int mark_count() const
Gets the number of marked subexpressions within the regular expression.
void swap(match_results &__that)
Swaps the contents of two match_results.
match_results(const _Alloc &__a=_Alloc())
Constructs a default match_results container.
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.
const_iterator begin() const
Gets an iterator to the start of the sub_match collection.
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
regex_token_iterator & operator=(const regex_token_iterator &__rhs)
Assigns a regex_token_iterator to another.
size_type size() const noexcept
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
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...
_Out_iter format(_Out_iter __out, const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
regex_traits()
Constructs a default traits object.
string_type str() const
Gets the matching sequence as a string.
const_reference suffix() const
Gets a sub_match representing the match suffix.
basic_regex(basic_regex &&__rhs)
Move-constructs a basic regular expression.
difference_type length() const
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
basic_regex(const basic_regex &__rhs)
Copy-constructs a basic regular expression.
allocator_type get_allocator() const
Gets a copy of the allocator.
sub_match< const wchar_t * > wcsub_match
Regex submatch over a C-style null-terminated wide string.
const _CharT * data() const noexcept
Return const pointer to contents.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
size_type size() const
Gets the number of matches and submatches.
basic_regex< char > regex
Standard regular expressions.
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...
regex_token_iterator & operator++()
Increments a regex_token_iterator.
char_type translate(char_type __c) const
Performs the identity translation.
basic_regex & assign(initializer_list< _Ch_type > __l, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
const_iterator cbegin() const
Gets an iterator to the start of the sub_match collection.
char_type translate_nocase(char_type __c) const
Translates a character into a case-insensitive equivalent.
bool isctype(_Ch_type __c, char_class_type __f) const
Determines if c is a member of an identified class.
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 size() const noexcept
Returns the number of characters in the string, not including any null-termination.
_BiIter second
first is a copy of the first object
const_reference prefix() const
Gets a sub_match representing the match prefix.
bool operator==(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for equality.
bool operator!=(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for inequality.
regex_iterator & operator=(const regex_iterator &__rhs)=default
Assigns one regex_iterator to another.
sub_match< wstring::const_iterator > wssub_match
Regex submatch over a standard wide string.
regex_token_iterator operator++(int)
Postincrements a regex_token_iterator.
bool empty() const noexcept
locale_type imbue(locale_type __loc)
Imbues the regex_traits object with a copy of a new locale.
regex_token_iterator< const char * > cregex_token_iterator
Token iterator for C-style NULL-terminated strings.
sub_match< const char * > csub_match
Standard regex submatch over a C-style null-terminated string.
int compare(const value_type *__s) const
Compares this sub_match to a C-style string.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
const value_type * operator->() const
Selects a regex_iterator member.
_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...
basic_regex & operator=(const basic_string< _Ch_type, _Ch_typeraits, _Alloc > &__s)
Replaces a regular expression with a new one constructed from a string.
Facet for localized string comparison.
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.
~basic_regex()
Destroys a basic regular expression.
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)
void swap(match_results< _Bi_iter, _Alloc > &__lhs, match_results< _Bi_iter, _Alloc > &__rhs)
Swaps two match results.
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)
locale_type getloc() const
Gets the locale currently imbued in the regular expression object.
regex_token_iterator< string::const_iterator > sregex_token_iterator
Token iterator for standard strings.
regex_token_iterator< const wchar_t * > wcregex_token_iterator
Token iterator for C-style NULL-terminated wide strings.
int compare(const basic_string &__str) const
Compare to a string.
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...
int compare(const sub_match &__s) const
Compares this and another matched sequence.
basic_regex & operator=(basic_regex &&__rhs)
Move-assigns one regular expression to another.
bool equal(_II1 __first1, _II1 __last1, _II2 __first2)
Tests a range for element-wise equality.
basic_regex< wchar_t > wregex
Standard wide-character regular expressions.
size_type max_size() const noexcept
const value_type & operator*() const
Dereferences a regex_iterator.
sub_match< string::const_iterator > ssub_match
Standard regex submatch over a standard string.
const_reference operator[](size_type __sub) const
Gets a sub_match reference for the match or submatch.
int compare(const string_type &__s) const
Compares this sub_match to a string.
match_flag_type
This is a bitmask type indicating regex matching rules.
regex_token_iterator(const regex_token_iterator &__rhs)
Copy constructs a regex_token_iterator.
const value_type & operator*() const
Dereferences a regex_token_iterator.
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)
regex_token_iterator()
Default constructs a regex_token_iterator.
const value_type * operator->() const
Selects a regex_token_iterator member.
size_type max_size() const
Gets the number of matches and submatches.
const_iterator end() const
Gets an iterator to one-past-the-end of the collection.
basic_regex & operator=(initializer_list< _Ch_type > __l)
Replaces a regular expression with a new one constructed from an initializer list.
_BiIter first
second_type is the second bound type
A standard container which offers fixed time access to individual elements in any order...
Managing sequences of characters and character-like objects.
const_iterator cend() const
Gets an iterator to one-past-the-end of the collection.
syntax_option_type
This is a bitmask type indicating how to interpret the regex.
bool ready() const
Indicates if the match_results is ready.
_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
Takes a regex and an input string in and do the matching.
string_type transform(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence.
Describes aspects of a regular expression.
iterator begin() noexcept
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
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)
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 & assign(const basic_string< _Ch_type, _Ch_typeraits, _Alloc > &__s, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object from a string containing a regular expression patt...
string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
Gets a collation element by name.
Basis for explicit traits specializations.
basic_regex(initializer_list< _Ch_type > __l, flag_type __f=ECMAScript)
Constructs a basic regular expression from an initializer list.
difference_type position(size_type __sub=0) const
Gets the offset of the beginning of the indicated submatch.
bool operator!=(const regex_iterator &__rhs) const
Tests the inequivalence of two regex iterators.
A smart pointer with reference-counted copy semantics.
locale_type getloc() const
Gets a copy of the current locale in use by the regex_traits object.
basic_regex & assign(_InputIterator __first, _InputIterator __last, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
difference_type length(size_type __sub=0) const
Gets the length of the indicated submatch.
bool operator!=(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for inequality.
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...
regex_token_iterator< wstring::const_iterator > wsregex_token_iterator
Token iterator for standard wide-character strings.
void swap(basic_regex &__rhs)
Swaps the contents of two regular expression objects.
The results of a match or search operation.
regex_iterator & operator++()
Increments a regex_iterator.
bool empty() const
Indicates if the match_results contains no results.
regex_iterator operator++(int)
Postincrements a regex_iterator.
string_type str(size_type __sub=0) const
Gets the match or submatch converted to a string type.
bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
int value(_Ch_type __ch, int __radix) const
Converts a digit to an int.
flag_type flags() const
Gets the flags used to construct the regular expression or in the last call to assign().
bitset< _Nb > operator~() const noexcept
See the no-argument flip().
basic_regex & assign(basic_regex &&__rhs)
The move-assignment operator.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
locale_type imbue(locale_type __loc)
Imbues the regular expression object with the given locale.
bool operator==(const regex_iterator &__rhs) const
Tests the equivalence of two regex iterators.
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)
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 & operator=(const basic_regex &__rhs)
Assigns one regular expression to another.
regex_iterator()
Provides a singular iterator, useful for indicating one-past-the-end of a range.
Forward iterators support a superset of input iterator operations.
basic_regex & assign(const basic_regex &__rhs)
the real assignment operator.
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)
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(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...