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)
115 operator&(_RegexMask __other)
const
117 return _RegexMask(_M_base & __other._M_base,
118 _M_extended & __other._M_extended);
122 operator|(_RegexMask __other)
const
124 return _RegexMask(_M_base | __other._M_base,
125 _M_extended | __other._M_extended);
129 operator^(_RegexMask __other)
const
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));
241 string_type __s(__first, __last);
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;
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)
451 basic_regex(
const _Ch_type* __p, flag_type __f = ECMAScript)
452 : basic_regex(__p, __p + _Rx_traits::length(__p), __f)
467 basic_regex(
const _Ch_type* __p, std::size_t __len,
468 flag_type __f = ECMAScript)
469 : basic_regex(__p, __p + __len, __f)
477 basic_regex(
const basic_regex& __rhs)
478 : _M_flags(__rhs._M_flags), _M_original_str(__rhs._M_original_str)
479 { this->imbue(__rhs.getloc()); }
489 basic_regex(basic_regex&& __rhs)
490 : _M_flags(__rhs._M_flags),
491 _M_original_str(
std::
move(__rhs._M_original_str))
493 this->imbue(__rhs.getloc());
494 __rhs._M_automaton.reset();
506 template<
typename _Ch_traits,
typename _Ch_alloc>
510 flag_type __f = ECMAScript)
511 : basic_regex(__s.
begin(), __s.
end(), __f)
527 template<
typename _FwdIter>
528 basic_regex(_FwdIter __first, _FwdIter __last,
529 flag_type __f = ECMAScript)
531 _M_original_str(__first, __last),
532 _M_automaton(__detail::__compile_nfa(_M_original_str.c_str(),
533 _M_original_str.c_str()
534 + _M_original_str.size(),
547 basic_regex(initializer_list<_Ch_type> __l, flag_type __f = ECMAScript)
548 : basic_regex(__l.
begin(), __l.
end(), __f)
561 operator=(
const basic_regex& __rhs)
562 {
return this->assign(__rhs); }
571 operator=(basic_regex&& __rhs)
572 {
return this->assign(
std::move(__rhs)); }
582 operator=(
const _Ch_type* __p)
583 {
return this->assign(__p, flags()); }
591 template<
typename _Ch_typeraits,
typename _Alloc>
593 operator=(
const basic_string<_Ch_type, _Ch_typeraits, _Alloc>& __s)
594 {
return this->assign(__s, flags()); }
603 assign(
const basic_regex& __rhs)
605 _M_flags = __rhs._M_flags;
606 _M_original_str = __rhs._M_original_str;
607 this->imbue(__rhs.getloc());
620 assign(basic_regex&& __rhs)
622 _M_flags = __rhs._M_flags;
623 _M_original_str =
std::move(__rhs._M_original_str);
624 __rhs._M_automaton.reset();
625 this->imbue(__rhs.getloc());
642 assign(
const _Ch_type* __p, flag_type __flags = ECMAScript)
643 {
return this->assign(string_type(__p), __flags); }
659 assign(
const _Ch_type* __p, std::size_t __len, flag_type __flags)
660 {
return this->assign(string_type(__p, __len), __flags); }
673 template<
typename _Ch_typeraits,
typename _Alloc>
675 assign(
const basic_string<_Ch_type, _Ch_typeraits, _Alloc>& __s,
676 flag_type __flags = ECMAScript)
679 _M_original_str.assign(__s.begin(), __s.end());
680 auto __p = _M_original_str.c_str();
681 _M_automaton = __detail::__compile_nfa(__p,
682 __p + _M_original_str.size(),
683 _M_traits, _M_flags);
700 template<
typename _InputIterator>
702 assign(_InputIterator __first, _InputIterator __last,
703 flag_type __flags = ECMAScript)
704 {
return this->assign(string_type(__first, __last), __flags); }
718 assign(initializer_list<_Ch_type> __l, flag_type __flags = ECMAScript)
719 {
return this->assign(__l.begin(), __l.end(), __flags); }
728 {
return _M_automaton->_M_sub_count() - 1; }
745 imbue(locale_type __loc)
747 auto __ret = _M_traits.imbue(__loc);
748 this->assign(_M_original_str, _M_flags);
758 {
return _M_traits.getloc(); }
767 swap(basic_regex& __rhs)
770 std::swap(_M_original_str, __rhs._M_original_str);
771 this->imbue(__rhs.imbue(this->getloc()));
774 #ifdef _GLIBCXX_DEBUG
776 _M_dot(std::ostream& __ostr)
777 { _M_automaton->_M_dot(__ostr); }
783 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
784 __detail::_RegexExecutorPolicy,
bool>
786 __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
787 const basic_regex<_Cp, _Rp>&,
790 template<
typename,
typename,
typename,
bool>
791 friend class __detail::_Executor;
794 _Rx_traits _M_traits;
795 basic_string<_Ch_type> _M_original_str;
796 _AutomatonPtr _M_automaton;
802 #ifdef _GLIBCXX_USE_WCHAR_T
814 template<
typename _Ch_type,
typename _Rx_traits>
818 { __lhs.swap(__rhs); }
834 template<
typename _BiIter>
837 typedef iterator_traits<_BiIter> __iter_traits;
840 typedef typename __iter_traits::value_type value_type;
841 typedef typename __iter_traits::difference_type difference_type;
842 typedef _BiIter iterator;
866 operator string_type()
const
933 #ifdef _GLIBCXX_USE_WCHAR_T
949 template<
typename _BiIter>
952 {
return __lhs.
compare(__rhs) == 0; }
960 template<
typename _BiIter>
963 {
return __lhs.
compare(__rhs) != 0; }
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; }
1010 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1011 using __sub_match_string = basic_string<
1012 typename iterator_traits<_Bi_iter>::value_type,
1013 _Ch_traits, _Ch_alloc>;
1022 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1035 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1039 {
return !(__lhs == __rhs); }
1047 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1049 operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1051 {
return __rhs.compare(__lhs.c_str()) > 0; }
1059 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1063 {
return __rhs < __lhs; }
1071 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1075 {
return !(__lhs < __rhs); }
1083 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1085 operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1087 {
return !(__rhs < __lhs); }
1096 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1109 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1113 {
return !(__lhs == __rhs); }
1121 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1123 operator<(const sub_match<_Bi_iter>& __lhs,
1125 {
return __lhs.compare(__rhs.c_str()) < 0; }
1133 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1137 {
return __rhs < __lhs; }
1145 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1149 {
return !(__lhs < __rhs); }
1157 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1159 operator<=(const sub_match<_Bi_iter>& __lhs,
1161 {
return !(__rhs < __lhs); }
1170 template<
typename _Bi_iter>
1172 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1174 {
return __rhs.
compare(__lhs) == 0; }
1183 template<
typename _Bi_iter>
1185 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1187 {
return !(__lhs == __rhs); }
1195 template<
typename _Bi_iter>
1197 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1199 {
return __rhs.compare(__lhs) > 0; }
1207 template<
typename _Bi_iter>
1209 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1211 {
return __rhs < __lhs; }
1219 template<
typename _Bi_iter>
1221 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1223 {
return !(__lhs < __rhs); }
1231 template<
typename _Bi_iter>
1233 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1235 {
return !(__rhs < __lhs); }
1244 template<
typename _Bi_iter>
1247 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1248 {
return __lhs.
compare(__rhs) == 0; }
1257 template<
typename _Bi_iter>
1260 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1261 {
return !(__lhs == __rhs); }
1269 template<
typename _Bi_iter>
1271 operator<(const sub_match<_Bi_iter>& __lhs,
1272 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1273 {
return __lhs.compare(__rhs) < 0; }
1281 template<
typename _Bi_iter>
1284 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1285 {
return __rhs < __lhs; }
1293 template<
typename _Bi_iter>
1296 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1297 {
return !(__lhs < __rhs); }
1305 template<
typename _Bi_iter>
1307 operator<=(const sub_match<_Bi_iter>& __lhs,
1308 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1309 {
return !(__rhs < __lhs); }
1318 template<
typename _Bi_iter>
1320 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1324 return __rhs.
compare(string_type(1, __lhs)) == 0;
1334 template<
typename _Bi_iter>
1336 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1338 {
return !(__lhs == __rhs); }
1346 template<
typename _Bi_iter>
1348 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1352 return __rhs.compare(string_type(1, __lhs)) > 0;
1361 template<
typename _Bi_iter>
1363 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1365 {
return __rhs < __lhs; }
1373 template<
typename _Bi_iter>
1375 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1377 {
return !(__lhs < __rhs); }
1385 template<
typename _Bi_iter>
1387 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1389 {
return !(__rhs < __lhs); }
1398 template<
typename _Bi_iter>
1401 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1404 return __lhs.
compare(string_type(1, __rhs)) == 0;
1414 template<
typename _Bi_iter>
1417 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1418 {
return !(__lhs == __rhs); }
1426 template<
typename _Bi_iter>
1428 operator<(const sub_match<_Bi_iter>& __lhs,
1429 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1432 return __lhs.
compare(string_type(1, __rhs)) < 0;
1441 template<
typename _Bi_iter>
1444 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1445 {
return __rhs < __lhs; }
1453 template<
typename _Bi_iter>
1456 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1457 {
return !(__lhs < __rhs); }
1465 template<
typename _Bi_iter>
1467 operator<=(const sub_match<_Bi_iter>& __lhs,
1468 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1469 {
return !(__rhs < __lhs); }
1479 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1481 basic_ostream<_Ch_type, _Ch_traits>&
1482 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1484 {
return __os << __m.
str(); }
1491 template<
typename _Bi_iter>
1492 inline const sub_match<_Bi_iter>&
1495 static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>();
1521 template<
typename _Bi_iter,
1522 typename _Alloc = allocator<sub_match<_Bi_iter> > >
1524 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1539 typedef std::iterator_traits<_Bi_iter> __iter_traits;
1547 typedef sub_match<_Bi_iter> value_type;
1548 typedef const value_type& const_reference;
1549 typedef const_reference reference;
1550 typedef typename _Base_type::const_iterator const_iterator;
1551 typedef const_iterator iterator;
1552 typedef typename __iter_traits::difference_type difference_type;
1553 typedef typename allocator_traits<_Alloc>::size_type size_type;
1554 typedef _Alloc allocator_type;
1555 typedef typename __iter_traits::value_type char_type;
1630 return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0;
1644 {
return size() == 0; }
1663 {
return (*
this)[__sub].length(); }
1682 (*
this)[__sub].first) : -1;
1695 str(size_type __sub = 0)
const
1696 {
return (*
this)[__sub].str(); }
1712 _GLIBCXX_DEBUG_ASSERT(
ready() );
1713 return __sub <
size()
1715 : __unmatched_sub<_Bi_iter>();
1729 _GLIBCXX_DEBUG_ASSERT(
ready() );
1732 : __unmatched_sub<_Bi_iter>();
1746 _GLIBCXX_DEBUG_ASSERT(
ready() );
1749 : __unmatched_sub<_Bi_iter>();
1764 {
return this->
begin(); }
1778 {
return this->
end(); }
1795 template<
typename _Out_iter>
1797 format(_Out_iter __out,
const char_type* __fmt_first,
1798 const char_type* __fmt_last,
1804 template<
typename _Out_iter,
typename _St,
typename _Sa>
1816 template<
typename _St,
typename _Sa>
1833 string_type __result;
1853 {
return _Base_type::get_allocator(); }
1869 swap(_M_begin, __that._M_begin);
1874 template<
typename,
typename,
typename,
bool>
1877 template<
typename,
typename,
typename>
1880 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
1881 __detail::_RegexExecutorPolicy,
bool>
1888 bool _M_in_iterator;
1891 typedef match_results<const char*> cmatch;
1892 typedef match_results<string::const_iterator> smatch;
1893 #ifdef _GLIBCXX_USE_WCHAR_T
1894 typedef match_results<const wchar_t*> wcmatch;
1895 typedef match_results<wstring::const_iterator> wsmatch;
1904 template<
typename _Bi_iter,
typename _Alloc>
1909 if (__m1.ready() != __m2.ready())
1913 if (__m1.empty() != __m2.empty())
1917 return __m1.prefix() == __m2.prefix()
1918 && __m1.size() == __m2.size()
1919 &&
std::equal(__m1.begin(), __m1.end(), __m2.begin())
1920 && __m1.suffix() == __m2.suffix();
1928 template<
typename _Bi_iter,
class _Alloc>
1932 {
return !(__m1 == __m2); }
1942 template<
typename _Bi_iter,
typename _Alloc>
1946 { __lhs.swap(__rhs); }
1969 template<
typename _Bi_iter,
typename _Alloc,
1970 typename _Ch_type,
typename _Rx_traits>
1979 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
1980 __detail::_RegexExecutorPolicy::_S_auto,
true>
1981 (__s, __e, __m, __re, __flags);
1998 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2006 return regex_match(__first, __last, __what, __re, __flags);
2023 template<
typename _Ch_type,
typename _Alloc,
typename _Rx_traits>
2030 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2046 template<
typename _Ch_traits,
typename _Ch_alloc,
2047 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2051 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2070 template<
typename _Ch_type,
class _Rx_traits>
2076 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2091 template<
typename _Ch_traits,
typename _Str_allocator,
2092 typename _Ch_type,
typename _Rx_traits>
2114 template<
typename _Bi_iter,
typename _Alloc,
2115 typename _Ch_type,
typename _Rx_traits>
2123 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2124 __detail::_RegexExecutorPolicy::_S_auto,
false>
2125 (__s, __e, __m, __re, __flags);
2139 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2147 return regex_search(__first, __last, __what, __re, __flags);
2162 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2169 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2181 template<
typename _Ch_type,
typename _Rx_traits>
2187 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2199 template<
typename _Ch_traits,
typename _String_allocator,
2200 typename _Ch_type,
typename _Rx_traits>
2203 _String_allocator>& __s,
2207 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2221 template<
typename _Ch_traits,
typename _Ch_alloc,
2222 typename _Alloc,
typename _Ch_type,
2223 typename _Rx_traits>
2227 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2247 template<
typename _Out_iter,
typename _Bi_iter,
2248 typename _Rx_traits,
typename _Ch_type,
2249 typename _St,
typename _Sa>
2273 template<
typename _Out_iter,
typename _Bi_iter,
2274 typename _Rx_traits,
typename _Ch_type>
2276 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
2277 const basic_regex<_Ch_type, _Rx_traits>& __e,
2278 const _Ch_type* __fmt,
2293 template<
typename _Rx_traits,
typename _Ch_type,
2294 typename _St,
typename _Sa,
typename _Fst,
typename _Fsa>
2295 inline basic_string<_Ch_type, _St, _Sa>
2304 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2319 template<
typename _Rx_traits,
typename _Ch_type,
2320 typename _St,
typename _Sa>
2321 inline basic_string<_Ch_type, _St, _Sa>
2324 const _Ch_type* __fmt,
2330 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2345 template<
typename _Rx_traits,
typename _Ch_type,
2346 typename _St,
typename _Sa>
2347 inline basic_string<_Ch_type>
2357 __e, __fmt, __flags);
2372 template<
typename _Rx_traits,
typename _Ch_type>
2373 inline basic_string<_Ch_type>
2376 const _Ch_type* __fmt,
2383 __e, __fmt, __flags);
2394 template<
typename _Bi_iter,
2395 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2396 typename _Rx_traits = regex_traits<_Ch_type> >
2402 typedef std::ptrdiff_t difference_type;
2403 typedef const value_type*
pointer;
2404 typedef const value_type& reference;
2425 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2427 if (!
regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags))
2453 {
return !(*
this == __rhs); }
2460 {
return _M_match; }
2467 {
return &_M_match; }
2489 const regex_type* _M_pregex;
2494 typedef regex_iterator<const char*> cregex_iterator;
2495 typedef regex_iterator<string::const_iterator> sregex_iterator;
2496 #ifdef _GLIBCXX_USE_WCHAR_T
2497 typedef regex_iterator<const wchar_t*> wcregex_iterator;
2498 typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
2509 template<
typename _Bi_iter,
2510 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2511 typename _Rx_traits = regex_traits<_Ch_type> >
2517 typedef std::ptrdiff_t difference_type;
2518 typedef const value_type*
pointer;
2519 typedef const value_type& reference;
2531 : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr),
2556 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2557 { _M_init(__a, __b); }
2569 const regex_type& __re,
2573 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2574 { _M_init(__a, __b); }
2586 const regex_type& __re,
2587 initializer_list<int> __submatches,
2590 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2591 { _M_init(__a, __b); }
2602 template<std::
size_t _Nm>
2604 const regex_type& __re,
2605 const int (&__submatches)[_Nm],
2608 : _M_position(__a, __b, __re, __m),
2609 _M_subs(__submatches, __submatches + _Nm), _M_n(0)
2610 { _M_init(__a, __b); }
2617 : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
2618 _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
2619 { _M_normalize_result(); }
2639 {
return !(*
this == __rhs); }
2646 {
return *_M_result; }
2653 {
return _M_result; }
2676 _M_init(_Bi_iter __a, _Bi_iter __b);
2679 _M_current_match()
const
2681 if (_M_subs[_M_n] == -1)
2682 return (*_M_position).prefix();
2684 return (*_M_position)[_M_subs[_M_n]];
2688 _M_end_of_seq()
const
2689 {
return _M_result ==
nullptr; }
2693 _M_normalize_result()
2695 if (_M_position != _Position())
2696 _M_result = &_M_current_match();
2698 _M_result = &_M_suffix;
2700 _M_result =
nullptr;
2703 _Position _M_position;
2705 value_type _M_suffix;
2707 const value_type* _M_result;
2719 #ifdef _GLIBCXX_USE_WCHAR_T
2728 _GLIBCXX_END_NAMESPACE_VERSION
2731 #include <bits/regex.tcc>
Container class for localization functionality.The locale class is first a class wrapper for C librar...
const_iterator cbegin() const
Gets an iterator to the start of the sub_match collection.
int compare(const value_type *__s) const
Compares this sub_match to a C-style string.
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 isctype(_Ch_type __c, char_class_type __f) const
Determines if c is a member of an identified class.
const _CharT * data() const noexcept
Return const pointer to contents.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
int value(_Ch_type __ch, int __radix) const
Converts a digit to an int.
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)
size_type max_size() const noexcept
difference_type position(size_type __sub=0) const
Gets the offset of the beginning of the indicated submatch.
string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
Gets a collation element by name.
locale_type getloc() const
Gets a copy of the current locale in use by the regex_traits object.
basic_regex< char > regex
Standard regular expressions.
regex_traits()
Constructs a default traits object.
regex_iterator operator++(int)
Postincrements a regex_iterator.
string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence, independent of case.
sub_match< wstring::const_iterator > wssub_match
Regex submatch over a standard wide string.
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)
bool empty() const noexcept
bool operator!=(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for inequality.
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
regex_token_iterator< string::const_iterator > sregex_token_iterator
Token iterator for standard strings.
string_type str() const
Gets the matching sequence as a string.
Forward iterators support a superset of input iterator operations.
bool operator!=(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for inequality.
const_reference suffix() const
Gets a sub_match representing the match suffix.
regex_iterator & operator=(const regex_iterator &__rhs)=default
Assigns one regex_iterator to another.
char_type translate_nocase(char_type __c) const
Translates a character into a case-insensitive equivalent.
sub_match< const wchar_t * > wcsub_match
Regex submatch over a C-style null-terminated wide string.
regex_iterator & operator++()
Increments a regex_iterator.
auto end(_Container &__cont) -> decltype(__cont.end())
Return an iterator pointing to one past the last element of the container.
regex_token_iterator & operator++()
Increments a regex_token_iterator.
size_type max_size() const
Gets the number of matches and submatches.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
A smart pointer with reference-counted copy semantics.
bool operator==(const regex_iterator &__rhs) const
Tests the equivalence of two regex iterators.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
syntax_option_type
This is a bitmask type indicating how to interpret the regex.
regex_token_iterator()
Default constructs a regex_token_iterator.
auto begin(_Container &__cont) -> decltype(__cont.begin())
Return an iterator pointing to the first element of the container.
match_flag_type
This is a bitmask type indicating regex matching rules.
const_reference prefix() const
Gets a sub_match representing the match prefix.
void swap(vector &__x) noexcept(_Alloc_traits::_S_nothrow_swap())
Swaps data with another vector.
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...
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
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)
regex_token_iterator(const regex_token_iterator &__rhs)
Copy constructs a regex_token_iterator.
int compare(const basic_string &__str) const
Compare to a string.
back_insert_iterator< _Container > back_inserter(_Container &__x)
string_type format(const char_type *__fmt, match_flag_type __flags=regex_constants::format_default) const
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
const_reference operator[](size_type __sub) const
Gets a sub_match reference for the match or submatch.
The results of a match or search operation.
_BiIter first
second_type is the second bound type
regex_token_iterator< const char * > cregex_token_iterator
Token iterator for C-style NULL-terminated strings.
int compare(const string_type &__s) const
Compares this sub_match to a string.
regex_iterator()
Provides a singular iterator, useful for indicating one-past-the-end of a range.
ISO C++ entities toplevel namespace is std.
char_type translate(char_type __c) const
Performs the identity translation.
const value_type * operator->() const
Selects a regex_iterator member.
bool equal(_II1 __first1, _II1 __last1, _II2 __first2)
Tests a range for element-wise equality.
bool operator!=(const regex_iterator &__rhs) const
Tests the inequivalence of two regex iterators.
regex_token_iterator & operator=(const regex_token_iterator &__rhs)
Assigns a regex_token_iterator to another.
Basis for explicit traits specializations.
bool operator==(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for equality.
const_iterator begin() const
Gets an iterator to the start of the sub_match collection.
iterator begin() noexcept
difference_type length() const
const value_type * operator->() const
Selects a regex_token_iterator member.
match_results(const _Alloc &__a=_Alloc())
Constructs a default match_results container.
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)
regex_token_iterator< const wchar_t * > wcregex_token_iterator
Token iterator for C-style NULL-terminated wide strings.
Describes aspects of a regular expression.
_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
_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< wchar_t > wregex
Standard wide-character regular expressions.
bool operator==(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for equality.
const value_type & operator*() const
Dereferences a regex_iterator.
locale_type imbue(locale_type __loc)
Imbues the regex_traits object with a copy of a new locale.
sub_match< string::const_iterator > ssub_match
Standard regex submatch over a standard string.
bool empty() const
Indicates if the match_results contains no results.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
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)
string_type str(size_type __sub=0) const
Gets the match or submatch converted to a string type.
_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 cend() const
Gets an iterator to one-past-the-end of the collection.
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
size_type size() const noexcept
void swap(match_results &__that)
Swaps the contents of two match_results.
size_type size() const
Gets the number of matches and submatches.
static std::size_t length(const char_type *__p)
Gives the length of a C-style string starting at __p.
regex_token_iterator operator++(int)
Postincrements a regex_token_iterator.
Struct holding two objects of arbitrary type.
A standard container which offers fixed time access to individual elements in any order...
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
allocator_type get_allocator() const
Gets a copy of the allocator.
Facet for localized string comparison.
int compare(const sub_match &__s) const
Compares this and another matched sequence.
string_type transform(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence.
const value_type & operator*() const
Dereferences a regex_token_iterator.
basic_string< char_type, _St, _Sa > format(const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
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.
_BiIter second
first is a copy of the first object
regex_token_iterator< wstring::const_iterator > wsregex_token_iterator
Token iterator for standard wide-character strings.
Takes a regex and an input string in and do the matching.
Managing sequences of characters and character-like objects.
difference_type length(size_type __sub=0) const
Gets the length of the indicated submatch.
bool ready() const
Indicates if the match_results is ready.
const_iterator end() const
Gets an iterator to one-past-the-end of the collection.
sub_match< const char * > csub_match
Standard regex submatch over a C-style null-terminated string.