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)
452 :
basic_regex(__p, __p + _Rx_traits::length(__p), __f)
468 flag_type __f = ECMAScript)
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>
514 flag_type __f = ECMAScript)
531 template<
typename _FwdIter>
533 flag_type __f = ECMAScript)
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(),
551 basic_regex(initializer_list<_Ch_type> __l, flag_type __f = ECMAScript)
566 {
return this->
assign(__rhs); }
595 template<
typename _Ch_typeraits,
typename _Alloc>
609 _M_flags = __rhs._M_flags;
610 _M_original_str = __rhs._M_original_str;
611 _M_traits.imbue(__rhs.getloc());
612 this->
assign(_M_original_str, _M_flags);
627 _M_flags = __rhs._M_flags;
628 _M_original_str =
std::move(__rhs._M_original_str);
629 __rhs._M_automaton.reset();
630 _M_traits.imbue(__rhs.getloc());
631 this->
assign(_M_original_str, _M_flags);
649 assign(
const _Ch_type* __p, flag_type __flags = ECMAScript)
650 {
return this->
assign(string_type(__p), __flags); }
666 assign(
const _Ch_type* __p, std::size_t __len, flag_type __flags)
667 {
return this->
assign(string_type(__p, __len), __flags); }
680 template<
typename _Ch_typeraits,
typename _Alloc>
683 flag_type __flags = ECMAScript)
685 _M_automaton = __detail::__compile_nfa(
686 __s.
data(), __s.
data() + __s.
size(), _M_traits, __flags);
687 _M_original_str = __s;
705 template<
typename _InputIterator>
707 assign(_InputIterator __first, _InputIterator __last,
708 flag_type __flags = ECMAScript)
709 {
return this->
assign(string_type(__first, __last), __flags); }
723 assign(initializer_list<_Ch_type> __l, flag_type __flags = ECMAScript)
724 {
return this->
assign(__l.begin(), __l.end(), __flags); }
735 return _M_automaton->_M_sub_count() - 1;
756 _M_automaton =
nullptr;
757 return _M_traits.imbue(__loc);
766 {
return _M_traits.getloc(); }
780 this->
assign(__rhs._M_original_str, _M_flags);
781 __rhs.assign(__tmp, __rhs._M_flags);
784 #ifdef _GLIBCXX_DEBUG
786 _M_dot(std::ostream& __ostr)
787 { _M_automaton->_M_dot(__ostr); }
793 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
794 __detail::_RegexExecutorPolicy,
bool>
796 __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
797 const basic_regex<_Cp, _Rp>&,
800 template<
typename,
typename,
typename,
bool>
801 friend class __detail::_Executor;
804 _Rx_traits _M_traits;
805 basic_string<_Ch_type> _M_original_str;
806 _AutomatonPtr _M_automaton;
812 #ifdef _GLIBCXX_USE_WCHAR_T
824 template<
typename _Ch_type,
typename _Rx_traits>
828 { __lhs.swap(__rhs); }
844 template<
typename _BiIter>
847 typedef iterator_traits<_BiIter> __iter_traits;
850 typedef typename __iter_traits::value_type value_type;
851 typedef typename __iter_traits::difference_type difference_type;
852 typedef _BiIter iterator;
876 operator string_type()
const
943 #ifdef _GLIBCXX_USE_WCHAR_T
959 template<
typename _BiIter>
962 {
return __lhs.
compare(__rhs) == 0; }
970 template<
typename _BiIter>
973 {
return __lhs.
compare(__rhs) != 0; }
981 template<
typename _BiIter>
984 {
return __lhs.
compare(__rhs) < 0; }
992 template<
typename _BiIter>
995 {
return __lhs.
compare(__rhs) <= 0; }
1003 template<
typename _BiIter>
1006 {
return __lhs.
compare(__rhs) >= 0; }
1014 template<
typename _BiIter>
1017 {
return __lhs.
compare(__rhs) > 0; }
1020 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1021 using __sub_match_string = basic_string<
1022 typename iterator_traits<_Bi_iter>::value_type,
1023 _Ch_traits, _Ch_alloc>;
1032 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1045 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1049 {
return !(__lhs == __rhs); }
1057 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1059 operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1061 {
return __rhs.
compare(__lhs.c_str()) > 0; }
1069 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1073 {
return __rhs < __lhs; }
1081 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1085 {
return !(__lhs < __rhs); }
1093 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1095 operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1097 {
return !(__rhs < __lhs); }
1106 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1119 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1123 {
return !(__lhs == __rhs); }
1131 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1133 operator<(const sub_match<_Bi_iter>& __lhs,
1135 {
return __lhs.
compare(__rhs.c_str()) < 0; }
1143 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1147 {
return __rhs < __lhs; }
1155 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1159 {
return !(__lhs < __rhs); }
1167 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1169 operator<=(const sub_match<_Bi_iter>& __lhs,
1171 {
return !(__rhs < __lhs); }
1180 template<
typename _Bi_iter>
1182 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1184 {
return __rhs.
compare(__lhs) == 0; }
1193 template<
typename _Bi_iter>
1195 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1197 {
return !(__lhs == __rhs); }
1205 template<
typename _Bi_iter>
1207 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1209 {
return __rhs.
compare(__lhs) > 0; }
1217 template<
typename _Bi_iter>
1219 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1221 {
return __rhs < __lhs; }
1229 template<
typename _Bi_iter>
1231 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1233 {
return !(__lhs < __rhs); }
1241 template<
typename _Bi_iter>
1243 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1245 {
return !(__rhs < __lhs); }
1254 template<
typename _Bi_iter>
1257 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1258 {
return __lhs.
compare(__rhs) == 0; }
1267 template<
typename _Bi_iter>
1270 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1271 {
return !(__lhs == __rhs); }
1279 template<
typename _Bi_iter>
1281 operator<(const sub_match<_Bi_iter>& __lhs,
1282 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1283 {
return __lhs.compare(__rhs) < 0; }
1291 template<
typename _Bi_iter>
1294 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1295 {
return __rhs < __lhs; }
1303 template<
typename _Bi_iter>
1306 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1307 {
return !(__lhs < __rhs); }
1315 template<
typename _Bi_iter>
1317 operator<=(const sub_match<_Bi_iter>& __lhs,
1318 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1319 {
return !(__rhs < __lhs); }
1328 template<
typename _Bi_iter>
1330 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1334 return __rhs.
compare(string_type(1, __lhs)) == 0;
1344 template<
typename _Bi_iter>
1346 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1348 {
return !(__lhs == __rhs); }
1356 template<
typename _Bi_iter>
1358 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1362 return __rhs.
compare(string_type(1, __lhs)) > 0;
1371 template<
typename _Bi_iter>
1373 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1375 {
return __rhs < __lhs; }
1383 template<
typename _Bi_iter>
1385 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1387 {
return !(__lhs < __rhs); }
1395 template<
typename _Bi_iter>
1397 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1399 {
return !(__rhs < __lhs); }
1408 template<
typename _Bi_iter>
1411 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1414 return __lhs.
compare(string_type(1, __rhs)) == 0;
1424 template<
typename _Bi_iter>
1427 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1428 {
return !(__lhs == __rhs); }
1436 template<
typename _Bi_iter>
1438 operator<(const sub_match<_Bi_iter>& __lhs,
1439 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1442 return __lhs.
compare(string_type(1, __rhs)) < 0;
1451 template<
typename _Bi_iter>
1454 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1455 {
return __rhs < __lhs; }
1463 template<
typename _Bi_iter>
1466 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1467 {
return !(__lhs < __rhs); }
1475 template<
typename _Bi_iter>
1477 operator<=(const sub_match<_Bi_iter>& __lhs,
1478 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1479 {
return !(__rhs < __lhs); }
1489 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1491 basic_ostream<_Ch_type, _Ch_traits>&
1492 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1494 {
return __os << __m.
str(); }
1501 template<
typename _Bi_iter>
1502 inline const sub_match<_Bi_iter>&
1505 static const sub_match<_Bi_iter> __unmatched = sub_match<_Bi_iter>();
1531 template<
typename _Bi_iter,
1532 typename _Alloc = allocator<sub_match<_Bi_iter> > >
1534 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1549 typedef std::iterator_traits<_Bi_iter> __iter_traits;
1557 typedef sub_match<_Bi_iter> value_type;
1558 typedef const value_type& const_reference;
1559 typedef const_reference reference;
1560 typedef typename _Base_type::const_iterator const_iterator;
1561 typedef const_iterator iterator;
1562 typedef typename __iter_traits::difference_type difference_type;
1563 typedef typename allocator_traits<_Alloc>::size_type size_type;
1564 typedef _Alloc allocator_type;
1565 typedef typename __iter_traits::value_type char_type;
1640 return (__size && _Base_type::operator[](0).matched) ? __size - 2 : 0;
1654 {
return size() == 0; }
1673 {
return (*
this)[__sub].length(); }
1692 (*
this)[__sub].first) : -1;
1705 str(size_type __sub = 0)
const
1706 {
return (*
this)[__sub].str(); }
1722 _GLIBCXX_DEBUG_ASSERT(
ready() );
1723 return __sub <
size()
1725 : __unmatched_sub<_Bi_iter>();
1739 _GLIBCXX_DEBUG_ASSERT(
ready() );
1742 : __unmatched_sub<_Bi_iter>();
1756 _GLIBCXX_DEBUG_ASSERT(
ready() );
1759 : __unmatched_sub<_Bi_iter>();
1774 {
return this->
begin(); }
1788 {
return this->
end(); }
1805 template<
typename _Out_iter>
1807 format(_Out_iter __out,
const char_type* __fmt_first,
1808 const char_type* __fmt_last,
1814 template<
typename _Out_iter,
typename _St,
typename _Sa>
1826 template<
typename _St,
typename _Sa>
1843 string_type __result;
1863 {
return _Base_type::get_allocator(); }
1880 swap(_M_begin, __that._M_begin);
1885 template<
typename,
typename,
typename,
bool>
1888 template<
typename,
typename,
typename>
1891 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
1892 __detail::_RegexExecutorPolicy,
bool>
1899 bool _M_in_iterator;
1902 typedef match_results<const char*> cmatch;
1903 typedef match_results<string::const_iterator> smatch;
1904 #ifdef _GLIBCXX_USE_WCHAR_T
1905 typedef match_results<const wchar_t*> wcmatch;
1906 typedef match_results<wstring::const_iterator> wsmatch;
1915 template<
typename _Bi_iter,
typename _Alloc>
1920 if (__m1.ready() != __m2.ready())
1924 if (__m1.empty() != __m2.empty())
1928 return __m1.prefix() == __m2.prefix()
1929 && __m1.size() == __m2.size()
1930 &&
std::equal(__m1.begin(), __m1.end(), __m2.begin())
1931 && __m1.suffix() == __m2.suffix();
1939 template<
typename _Bi_iter,
class _Alloc>
1943 {
return !(__m1 == __m2); }
1953 template<
typename _Bi_iter,
typename _Alloc>
1957 { __lhs.swap(__rhs); }
1980 template<
typename _Bi_iter,
typename _Alloc,
1981 typename _Ch_type,
typename _Rx_traits>
1990 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
1991 __detail::_RegexExecutorPolicy::_S_auto,
true>
1992 (__s, __e, __m, __re, __flags);
2009 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2017 return regex_match(__first, __last, __what, __re, __flags);
2034 template<
typename _Ch_type,
typename _Alloc,
typename _Rx_traits>
2041 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2057 template<
typename _Ch_traits,
typename _Ch_alloc,
2058 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2062 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2081 template<
typename _Ch_type,
class _Rx_traits>
2087 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2102 template<
typename _Ch_traits,
typename _Str_allocator,
2103 typename _Ch_type,
typename _Rx_traits>
2125 template<
typename _Bi_iter,
typename _Alloc,
2126 typename _Ch_type,
typename _Rx_traits>
2134 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2135 __detail::_RegexExecutorPolicy::_S_auto,
false>
2136 (__s, __e, __m, __re, __flags);
2150 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2158 return regex_search(__first, __last, __what, __re, __flags);
2173 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2180 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2192 template<
typename _Ch_type,
typename _Rx_traits>
2198 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2210 template<
typename _Ch_traits,
typename _String_allocator,
2211 typename _Ch_type,
typename _Rx_traits>
2214 _String_allocator>& __s,
2218 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2232 template<
typename _Ch_traits,
typename _Ch_alloc,
2233 typename _Alloc,
typename _Ch_type,
2234 typename _Rx_traits>
2238 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2258 template<
typename _Out_iter,
typename _Bi_iter,
2259 typename _Rx_traits,
typename _Ch_type,
2260 typename _St,
typename _Sa>
2284 template<
typename _Out_iter,
typename _Bi_iter,
2285 typename _Rx_traits,
typename _Ch_type>
2287 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
2288 const basic_regex<_Ch_type, _Rx_traits>& __e,
2289 const _Ch_type* __fmt,
2304 template<
typename _Rx_traits,
typename _Ch_type,
2305 typename _St,
typename _Sa,
typename _Fst,
typename _Fsa>
2306 inline basic_string<_Ch_type, _St, _Sa>
2315 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2330 template<
typename _Rx_traits,
typename _Ch_type,
2331 typename _St,
typename _Sa>
2332 inline basic_string<_Ch_type, _St, _Sa>
2335 const _Ch_type* __fmt,
2341 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2356 template<
typename _Rx_traits,
typename _Ch_type,
2357 typename _St,
typename _Sa>
2358 inline basic_string<_Ch_type>
2368 __e, __fmt, __flags);
2383 template<
typename _Rx_traits,
typename _Ch_type>
2384 inline basic_string<_Ch_type>
2387 const _Ch_type* __fmt,
2394 __e, __fmt, __flags);
2405 template<
typename _Bi_iter,
2406 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2407 typename _Rx_traits = regex_traits<_Ch_type> >
2413 typedef std::ptrdiff_t difference_type;
2414 typedef const value_type*
pointer;
2415 typedef const value_type& reference;
2436 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2438 if (!
regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags))
2464 {
return !(*
this == __rhs); }
2471 {
return _M_match; }
2478 {
return &_M_match; }
2500 const regex_type* _M_pregex;
2505 typedef regex_iterator<const char*> cregex_iterator;
2506 typedef regex_iterator<string::const_iterator> sregex_iterator;
2507 #ifdef _GLIBCXX_USE_WCHAR_T
2508 typedef regex_iterator<const wchar_t*> wcregex_iterator;
2509 typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
2520 template<
typename _Bi_iter,
2521 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2522 typename _Rx_traits = regex_traits<_Ch_type> >
2528 typedef std::ptrdiff_t difference_type;
2529 typedef const value_type*
pointer;
2530 typedef const value_type& reference;
2542 : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr),
2567 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2568 { _M_init(__a, __b); }
2580 const regex_type& __re,
2584 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2585 { _M_init(__a, __b); }
2597 const regex_type& __re,
2598 initializer_list<int> __submatches,
2601 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2602 { _M_init(__a, __b); }
2613 template<std::
size_t _Nm>
2615 const regex_type& __re,
2616 const int (&__submatches)[_Nm],
2619 : _M_position(__a, __b, __re, __m),
2620 _M_subs(__submatches, __submatches + _Nm), _M_n(0)
2621 { _M_init(__a, __b); }
2628 : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
2629 _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
2630 { _M_normalize_result(); }
2650 {
return !(*
this == __rhs); }
2657 {
return *_M_result; }
2664 {
return _M_result; }
2687 _M_init(_Bi_iter __a, _Bi_iter __b);
2690 _M_current_match()
const
2692 if (_M_subs[_M_n] == -1)
2693 return (*_M_position).prefix();
2695 return (*_M_position)[_M_subs[_M_n]];
2699 _M_end_of_seq()
const
2700 {
return _M_result ==
nullptr; }
2704 _M_normalize_result()
2706 if (_M_position != _Position())
2707 _M_result = &_M_current_match();
2709 _M_result = &_M_suffix;
2711 _M_result =
nullptr;
2714 _Position _M_position;
2716 value_type _M_suffix;
2718 const value_type* _M_result;
2730 #ifdef _GLIBCXX_USE_WCHAR_T
2739 _GLIBCXX_END_NAMESPACE_VERSION
2742 #include <bits/regex.tcc>
_BiIter first
second_type is the second bound type
bool operator!=(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for inequality.
basic_regex & operator=(basic_regex &&__rhs)
Move-assigns one regular expression to another.
_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...
char_type translate_nocase(char_type __c) const
Translates a character into a case-insensitive equivalent.
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...
int value(_Ch_type __ch, int __radix) const
Converts a digit to an int.
size_type size() const
Gets the number of matches and submatches.
A standard container which offers fixed time access to individual elements in any order...
basic_string< char_type, _St, _Sa > format(const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
syntax_option_type
This is a bitmask type indicating how to interpret the regex.
size_type max_size() const noexcept
regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, int __submatch=0, regex_constants::match_flag_type __m=regex_constants::match_default)
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
regex_iterator & operator=(const regex_iterator &__rhs)=default
Assigns one regex_iterator to another.
allocator_type get_allocator() const
Gets a copy of the allocator.
const_iterator end() const
Gets an iterator to one-past-the-end of the collection.
string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence, independent of case.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
const_reference suffix() const
Gets a sub_match representing the match suffix.
int compare(const sub_match &__s) const
Compares this and another matched sequence.
basic_regex< wchar_t > wregex
Standard wide-character regular expressions.
size_type size() const noexcept
locale_type imbue(locale_type __loc)
Imbues the regular expression object with the given locale.
basic_regex & assign(initializer_list< _Ch_type > __l, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
string_type format(const char_type *__fmt, match_flag_type __flags=regex_constants::format_default) const
A smart pointer with reference-counted copy semantics.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
Facet for localized string comparison.
locale_type getloc() const
Gets the locale currently imbued in the regular expression object.
auto begin(_Container &__cont) -> decltype(__cont.begin())
Return an iterator pointing to the first element of the container.
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)
void swap(match_results &__that)
Swaps the contents of two match_results.
Basis for explicit traits specializations.
~basic_regex()
Destroys a basic regular expression.
const_iterator cbegin() const
Gets an iterator to the start of the sub_match collection.
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.
int compare(const value_type *__s) const
Compares this sub_match to a C-style string.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
const value_type * operator->() const
Selects a regex_token_iterator member.
Describes aspects of a regular expression.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
unsigned int mark_count() const
Gets the number of marked subexpressions within the regular expression.
bool operator!=(const regex_iterator &__rhs) const
Tests the inequivalence of two regex iterators.
bool operator==(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for equality.
difference_type length() const
const value_type * operator->() const
Selects a regex_iterator member.
regex_token_iterator(const regex_token_iterator &__rhs)
Copy constructs a regex_token_iterator.
bool empty() const
Indicates if the match_results contains no results.
basic_regex(basic_regex &&__rhs)
Move-constructs a basic regular expression.
basic_regex(const basic_regex &__rhs)
Copy-constructs a basic regular expression.
sub_match< wstring::const_iterator > wssub_match
Regex submatch over a standard wide string.
size_type max_size() const
Gets the number of matches and submatches.
regex_iterator()
Provides a singular iterator, useful for indicating one-past-the-end of a range.
match_flag_type
This is a bitmask type indicating regex matching rules.
bool operator!=(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for inequality.
string_type str(size_type __sub=0) const
Gets the match or submatch converted to a string type.
The results of a match or search operation.
regex_token_iterator< wstring::const_iterator > wsregex_token_iterator
Token iterator for standard wide-character strings.
bool operator==(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for equality.
match_results(const _Alloc &__a=_Alloc())
Constructs a default match_results container.
regex_token_iterator()
Default constructs a regex_token_iterator.
void swap(vector &__x) noexcept(_Alloc_traits::_S_nothrow_swap())
Swaps data with another vector.
difference_type length(size_type __sub=0) const
Gets the length of the indicated submatch.
regex_token_iterator< string::const_iterator > sregex_token_iterator
Token iterator for standard strings.
Struct holding two objects of arbitrary type.
flag_type flags() const
Gets the flags used to construct the regular expression or in the last call to assign().
_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
Managing sequences of characters and character-like objects.
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...
const_reference prefix() const
Gets a sub_match representing the match prefix.
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(initializer_list< _Ch_type > __l, flag_type __f=ECMAScript)
Constructs a basic regular expression from an initializer list.
locale_type getloc() const
Gets a copy of the current locale in use by the regex_traits object.
int compare(const basic_string &__str) const
Compare to a string.
const_reference operator[](size_type __sub) const
Gets a sub_match reference for the match or submatch.
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...
regex_token_iterator< const wchar_t * > wcregex_token_iterator
Token iterator for C-style NULL-terminated wide strings.
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.
char_type translate(char_type __c) const
Performs the identity translation.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
sub_match< const char * > csub_match
Standard regex submatch over a C-style null-terminated 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 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)
_BiIter second
first is a copy of the first object
string_type str() const
Gets the matching sequence as a 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)
void swap(basic_regex &__rhs)
Swaps the contents of two regular expression objects.
string_type transform(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence.
basic_regex & assign(_InputIterator __first, _InputIterator __last, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
regex_token_iterator & operator=(const regex_token_iterator &__rhs)
Assigns a regex_token_iterator to another.
back_insert_iterator< _Container > back_inserter(_Container &__x)
basic_regex & operator=(const basic_string< _Ch_type, _Ch_typeraits, _Alloc > &__s)
Replaces a regular expression with a new one constructed from a string.
basic_regex & assign(basic_regex &&__rhs)
The move-assignment operator.
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
bool isctype(_Ch_type __c, char_class_type __f) const
Determines if c is a member of an identified class.
basic_regex & operator=(const basic_regex &__rhs)
Assigns one regular expression to another.
iterator begin() noexcept
const_iterator begin() const
Gets an iterator to the start of the sub_match collection.
regex_token_iterator & operator++()
Increments a regex_token_iterator.
Forward iterators support a superset of input iterator operations.
const _CharT * data() const noexcept
Return const pointer to contents.
_Out_iter format(_Out_iter __out, const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
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_iterator & operator++()
Increments a regex_iterator.
regex_iterator operator++(int)
Postincrements a regex_iterator.
bool empty() const noexcept
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)
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...
const_iterator cend() const
Gets an iterator to one-past-the-end of the collection.
difference_type position(size_type __sub=0) const
Gets the offset of the beginning of the indicated submatch.
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...
static std::size_t length(const char_type *__p)
Gives the length of a C-style string starting at __p.
auto end(_Container &__cont) -> decltype(__cont.end())
Return an iterator pointing to one past the last element of the container.
Takes a regex and an input string in and do the matching.
basic_regex< char > regex
Standard regular expressions.
regex_token_iterator operator++(int)
Postincrements a regex_token_iterator.
sub_match< const wchar_t * > wcsub_match
Regex submatch over a C-style null-terminated wide string.
basic_regex & operator=(const _Ch_type *__p)
Replaces a regular expression with a new one constructed from a C-style null-terminated string...
string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
Gets a collation element by name.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
const value_type & operator*() const
Dereferences a regex_token_iterator.
basic_regex & assign(const basic_regex &__rhs)
the real assignment operator.
ISO C++ entities toplevel namespace is std.
regex_traits()
Constructs a default traits object.
bool ready() const
Indicates if the match_results is ready.
locale_type imbue(locale_type __loc)
Imbues the regex_traits object with a copy of a new locale.
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...
const value_type & operator*() const
Dereferences a regex_iterator.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
sub_match< string::const_iterator > ssub_match
Standard regex submatch over a standard string.
bool operator==(const regex_iterator &__rhs) const
Tests the equivalence of two regex iterators.
iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
bool equal(_II1 __first1, _II1 __last1, _II2 __first2)
Tests a range for element-wise equality.