31 namespace std _GLIBCXX_VISIBILITY(default)
33 _GLIBCXX_BEGIN_NAMESPACE_VERSION
34 _GLIBCXX_BEGIN_NAMESPACE_CXX11
35 template<
typename,
typename>
38 template<
typename,
typename>
41 _GLIBCXX_END_NAMESPACE_CXX11
45 enum class _RegexExecutorPolicy : int
46 { _S_auto, _S_alternate };
48 template<
typename _BiIter,
typename _Alloc,
49 typename _CharT,
typename _TraitsT,
50 _RegexExecutorPolicy __policy,
53 __regex_algo_impl(_BiIter __s,
59 template<
typename,
typename,
typename,
bool>
63 _GLIBCXX_BEGIN_NAMESPACE_CXX11
80 template<
typename _Ch_type>
84 typedef _Ch_type char_type;
90 typedef std::ctype_base::mask _BaseType;
92 unsigned char _M_extended;
93 static constexpr
unsigned char _S_under = 1 << 0;
94 static constexpr
unsigned char _S_valid_mask = 0x1;
96 constexpr _RegexMask(_BaseType __base = 0,
97 unsigned char __extended = 0)
98 : _M_base(__base), _M_extended(__extended)
104 return _RegexMask(_M_base & __other._M_base,
105 _M_extended & __other._M_extended);
111 return _RegexMask(_M_base | __other._M_base,
112 _M_extended | __other._M_extended);
118 return _RegexMask(_M_base ^ __other._M_base,
119 _M_extended ^ __other._M_extended);
124 {
return _RegexMask(~_M_base, ~_M_extended); }
127 operator&=(_RegexMask __other)
128 {
return *
this = (*this) & __other; }
131 operator|=(_RegexMask __other)
132 {
return *
this = (*this) | __other; }
135 operator^=(_RegexMask __other)
136 {
return *
this = (*this) ^ __other; }
139 operator==(_RegexMask __other)
const 141 return (_M_extended & _S_valid_mask)
142 == (__other._M_extended & _S_valid_mask)
143 && _M_base == __other._M_base;
147 operator!=(_RegexMask __other)
const 148 {
return !((*this) == __other); }
152 typedef _RegexMask char_class_type;
172 {
return string_type::traits_type::length(__p); }
198 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
199 return __fctyp.tolower(__c);
222 template<
typename _Fwd_iter>
227 const __collate_type& __fclt(use_facet<__collate_type>(_M_locale));
229 return __fclt.transform(__s.
data(), __s.
data() + __s.
size());
246 template<
typename _Fwd_iter>
257 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
274 template<
typename _Fwd_iter>
315 template<
typename _Fwd_iter>
318 bool __icase =
false)
const;
333 isctype(_Ch_type __c, char_class_type __f)
const;
346 value(_Ch_type __ch,
int __radix)
const;
362 std::swap(_M_locale, __loc);
372 {
return _M_locale; }
375 locale_type _M_locale;
386 template<
typename _Ch_type,
typename _Rx_traits = regex_traits<_Ch_type>>
390 static_assert(is_same<_Ch_type, typename _Rx_traits::char_type>::value,
391 "regex traits class must have the same char_type");
394 typedef _Ch_type value_type;
395 typedef _Rx_traits traits_type;
396 typedef typename traits_type::string_type string_type;
398 typedef typename traits_type::locale_type locale_type;
423 : _M_flags(ECMAScript), _M_loc(), _M_automaton(nullptr)
482 template<
typename _Ch_traits,
typename _Ch_alloc>
487 :
basic_regex(__s.data(), __s.data() + __s.size(), __f)
503 template<
typename _FwdIter>
532 {
return this->
assign(__rhs); }
539 {
return this->
assign(std::move(__rhs)); }
550 {
return this->
assign(__p); }
562 {
return this->
assign(__l.begin(), __l.end()); }
570 template<
typename _Ch_traits,
typename _Alloc>
573 {
return this->
assign(__s); }
617 {
return this->
assign(string_type(__p), __flags); }
634 {
return this->
assign(string_type(__p, __len), __flags); }
647 template<
typename _Ch_traits,
typename _Alloc>
669 template<
typename _InputIterator>
671 assign(_InputIterator __first, _InputIterator __last,
673 {
return this->
assign(string_type(__first, __last), __flags); }
688 {
return this->
assign(__l.begin(), __l.end(), __flags); }
699 return _M_automaton->_M_sub_count() - 1;
720 std::swap(__loc, _M_loc);
721 _M_automaton.reset();
742 std::swap(_M_flags, __rhs._M_flags);
743 std::swap(_M_loc, __rhs._M_loc);
744 std::swap(_M_automaton, __rhs._M_automaton);
747 #ifdef _GLIBCXX_DEBUG 750 { _M_automaton->_M_dot(__ostr); }
756 template<
typename _FwdIter>
757 basic_regex(_FwdIter __first, _FwdIter __last, locale_type __loc,
759 : _M_flags(__f), _M_loc(
std::move(__loc)),
760 _M_automaton(__detail::__compile_nfa<_Rx_traits>(
761 std::move(__first),
std::move(__last), _M_loc, _M_flags))
764 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
765 __detail::_RegexExecutorPolicy,
bool>
767 __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&,
768 const basic_regex<_Cp, _Rp>&,
771 template<
typename,
typename,
typename,
bool>
772 friend class __detail::_Executor;
776 _AutomatonPtr _M_automaton;
779 #if __cpp_deduction_guides >= 201606 780 template<
typename _ForwardIterator>
781 basic_regex(_ForwardIterator, _ForwardIterator,
783 -> basic_regex<
typename iterator_traits<_ForwardIterator>::value_type>;
789 #ifdef _GLIBCXX_USE_WCHAR_T 801 template<
typename _Ch_type,
typename _Rx_traits>
805 { __lhs.swap(__rhs); }
821 template<
typename _BiIter>
824 typedef iterator_traits<_BiIter> __iter_traits;
827 typedef typename __iter_traits::value_type value_type;
828 typedef typename __iter_traits::difference_type difference_type;
829 typedef _BiIter iterator;
853 operator string_type()
const 920 #ifdef _GLIBCXX_USE_WCHAR_T 936 template<
typename _BiIter>
939 {
return __lhs.
compare(__rhs) == 0; }
947 template<
typename _BiIter>
950 {
return __lhs.
compare(__rhs) != 0; }
958 template<
typename _BiIter>
961 {
return __lhs.
compare(__rhs) < 0; }
969 template<
typename _BiIter>
972 {
return __lhs.
compare(__rhs) <= 0; }
980 template<
typename _BiIter>
983 {
return __lhs.
compare(__rhs) >= 0; }
991 template<
typename _BiIter>
994 {
return __lhs.
compare(__rhs) > 0; }
997 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
998 using __sub_match_string = basic_string<
999 typename iterator_traits<_Bi_iter>::value_type,
1000 _Ch_traits, _Ch_alloc>;
1009 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1025 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1029 {
return !(__lhs == __rhs); }
1037 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1039 operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1043 return __rhs.
compare(string_type(__lhs.data(), __lhs.size())) > 0;
1052 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1056 {
return __rhs < __lhs; }
1064 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1068 {
return !(__lhs < __rhs); }
1076 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1078 operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1080 {
return !(__rhs < __lhs); }
1089 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1105 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1109 {
return !(__lhs == __rhs); }
1117 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1119 operator<(const sub_match<_Bi_iter>& __lhs,
1123 return __lhs.
compare(string_type(__rhs.data(), __rhs.size())) < 0;
1132 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1136 {
return __rhs < __lhs; }
1144 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1148 {
return !(__lhs < __rhs); }
1156 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1158 operator<=(const sub_match<_Bi_iter>& __lhs,
1160 {
return !(__rhs < __lhs); }
1169 template<
typename _Bi_iter>
1171 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1173 {
return __rhs.
compare(__lhs) == 0; }
1182 template<
typename _Bi_iter>
1184 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1186 {
return !(__lhs == __rhs); }
1194 template<
typename _Bi_iter>
1196 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1198 {
return __rhs.
compare(__lhs) > 0; }
1206 template<
typename _Bi_iter>
1208 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1210 {
return __rhs < __lhs; }
1218 template<
typename _Bi_iter>
1220 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1222 {
return !(__lhs < __rhs); }
1230 template<
typename _Bi_iter>
1232 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1234 {
return !(__rhs < __lhs); }
1243 template<
typename _Bi_iter>
1246 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1247 {
return __lhs.
compare(__rhs) == 0; }
1256 template<
typename _Bi_iter>
1259 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1260 {
return !(__lhs == __rhs); }
1268 template<
typename _Bi_iter>
1270 operator<(const sub_match<_Bi_iter>& __lhs,
1271 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1272 {
return __lhs.compare(__rhs) < 0; }
1280 template<
typename _Bi_iter>
1283 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1284 {
return __rhs < __lhs; }
1292 template<
typename _Bi_iter>
1295 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1296 {
return !(__lhs < __rhs); }
1304 template<
typename _Bi_iter>
1306 operator<=(const sub_match<_Bi_iter>& __lhs,
1307 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1308 {
return !(__rhs < __lhs); }
1317 template<
typename _Bi_iter>
1319 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1323 return __rhs.
compare(string_type(1, __lhs)) == 0;
1333 template<
typename _Bi_iter>
1335 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1337 {
return !(__lhs == __rhs); }
1345 template<
typename _Bi_iter>
1347 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1351 return __rhs.
compare(string_type(1, __lhs)) > 0;
1360 template<
typename _Bi_iter>
1362 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1364 {
return __rhs < __lhs; }
1372 template<
typename _Bi_iter>
1374 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1376 {
return !(__lhs < __rhs); }
1384 template<
typename _Bi_iter>
1386 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1388 {
return !(__rhs < __lhs); }
1397 template<
typename _Bi_iter>
1400 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1403 return __lhs.
compare(string_type(1, __rhs)) == 0;
1413 template<
typename _Bi_iter>
1416 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1417 {
return !(__lhs == __rhs); }
1425 template<
typename _Bi_iter>
1427 operator<(const sub_match<_Bi_iter>& __lhs,
1428 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1431 return __lhs.
compare(string_type(1, __rhs)) < 0;
1440 template<
typename _Bi_iter>
1443 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1444 {
return __rhs < __lhs; }
1452 template<
typename _Bi_iter>
1455 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1456 {
return !(__lhs < __rhs); }
1464 template<
typename _Bi_iter>
1466 operator<=(const sub_match<_Bi_iter>& __lhs,
1467 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1468 {
return !(__rhs < __lhs); }
1478 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1480 basic_ostream<_Ch_type, _Ch_traits>&
1481 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1483 {
return __os << __m.
str(); }
1509 template<
typename _Bi_iter,
1510 typename _Alloc = allocator<sub_match<_Bi_iter> > >
1512 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1532 typedef std::iterator_traits<_Bi_iter> __iter_traits;
1540 typedef sub_match<_Bi_iter> value_type;
1541 typedef const value_type& const_reference;
1542 typedef value_type& reference;
1543 typedef typename _Base_type::const_iterator const_iterator;
1544 typedef const_iterator iterator;
1545 typedef typename __iter_traits::difference_type difference_type;
1547 typedef _Alloc allocator_type;
1548 typedef typename __iter_traits::value_type char_type;
1634 {
return size() == 0; }
1653 {
return (*
this)[__sub].length(); }
1680 str(size_type __sub = 0)
const 1697 __glibcxx_assert(
ready() );
1698 return __sub <
size()
1700 : _M_unmatched_sub();
1714 __glibcxx_assert(
ready() );
1715 return !
empty() ? _M_prefix() : _M_unmatched_sub();
1729 __glibcxx_assert(
ready() );
1730 return !
empty() ? _M_suffix() : _M_unmatched_sub();
1745 {
return this->
begin(); }
1759 {
return this->
end(); }
1776 template<
typename _Out_iter>
1778 format(_Out_iter __out,
const char_type* __fmt_first,
1779 const char_type* __fmt_last,
1785 template<
typename _Out_iter,
typename _St,
typename _Sa>
1797 template<
typename _St,
typename _Sa>
1834 {
return _Base_type::get_allocator(); }
1851 swap(_M_begin, __that._M_begin);
1856 template<
typename,
typename,
typename,
bool>
1859 template<
typename,
typename,
typename>
1862 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
1863 __detail::_RegexExecutorPolicy,
bool>
1870 _M_resize(
unsigned int __size)
1874 _M_unmatched_sub()
const 1877 sub_match<_Bi_iter>&
1885 sub_match<_Bi_iter>&
1893 sub_match<_Bi_iter>&
1900 typedef match_results<const char*> cmatch;
1901 typedef match_results<string::const_iterator> smatch;
1902 #ifdef _GLIBCXX_USE_WCHAR_T 1903 typedef match_results<const wchar_t*> wcmatch;
1904 typedef match_results<wstring::const_iterator> wsmatch;
1913 template<
typename _Bi_iter,
typename _Alloc>
1918 if (__m1.ready() != __m2.ready())
1922 if (__m1.empty() != __m2.empty())
1926 return __m1.prefix() == __m2.prefix()
1927 && __m1.size() == __m2.size()
1928 &&
std::equal(__m1.begin(), __m1.end(), __m2.begin())
1929 && __m1.suffix() == __m2.suffix();
1937 template<
typename _Bi_iter,
class _Alloc>
1941 {
return !(__m1 == __m2); }
1951 template<
typename _Bi_iter,
typename _Alloc>
1955 { __lhs.swap(__rhs); }
1957 _GLIBCXX_END_NAMESPACE_CXX11
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,
2071 template<
typename _Ch_traits,
typename _Ch_alloc,
2072 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2074 regex_match(
const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&,
2075 match_results<
typename basic_string<_Ch_type,
2076 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2077 const basic_regex<_Ch_type, _Rx_traits>&,
2094 template<
typename _Ch_type,
class _Rx_traits>
2100 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2115 template<
typename _Ch_traits,
typename _Str_allocator,
2116 typename _Ch_type,
typename _Rx_traits>
2138 template<
typename _Bi_iter,
typename _Alloc,
2139 typename _Ch_type,
typename _Rx_traits>
2147 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2148 __detail::_RegexExecutorPolicy::_S_auto,
false>
2149 (__s, __e, __m, __re, __flags);
2163 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2171 return regex_search(__first, __last, __what, __re, __flags);
2186 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2193 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2205 template<
typename _Ch_type,
typename _Rx_traits>
2211 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2223 template<
typename _Ch_traits,
typename _String_allocator,
2224 typename _Ch_type,
typename _Rx_traits>
2227 _String_allocator>& __s,
2231 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2245 template<
typename _Ch_traits,
typename _Ch_alloc,
2246 typename _Alloc,
typename _Ch_type,
2247 typename _Rx_traits>
2251 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2260 template<
typename _Ch_traits,
typename _Ch_alloc,
2261 typename _Alloc,
typename _Ch_type,
2262 typename _Rx_traits>
2264 regex_search(
const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&,
2265 match_results<
typename basic_string<_Ch_type,
2266 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2267 const basic_regex<_Ch_type, _Rx_traits>&,
2285 template<
typename _Out_iter,
typename _Bi_iter,
2286 typename _Rx_traits,
typename _Ch_type,
2287 typename _St,
typename _Sa>
2311 template<
typename _Out_iter,
typename _Bi_iter,
2312 typename _Rx_traits,
typename _Ch_type>
2314 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
2315 const basic_regex<_Ch_type, _Rx_traits>& __e,
2316 const _Ch_type* __fmt,
2331 template<
typename _Rx_traits,
typename _Ch_type,
2332 typename _St,
typename _Sa,
typename _Fst,
typename _Fsa>
2333 inline basic_string<_Ch_type, _St, _Sa>
2342 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2357 template<
typename _Rx_traits,
typename _Ch_type,
2358 typename _St,
typename _Sa>
2359 inline basic_string<_Ch_type, _St, _Sa>
2362 const _Ch_type* __fmt,
2368 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2383 template<
typename _Rx_traits,
typename _Ch_type,
2384 typename _St,
typename _Sa>
2385 inline basic_string<_Ch_type>
2395 __e, __fmt, __flags);
2410 template<
typename _Rx_traits,
typename _Ch_type>
2411 inline basic_string<_Ch_type>
2414 const _Ch_type* __fmt,
2421 __e, __fmt, __flags);
2427 _GLIBCXX_BEGIN_NAMESPACE_CXX11
2434 template<
typename _Bi_iter,
2435 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2436 typename _Rx_traits = regex_traits<_Ch_type> >
2442 typedef std::ptrdiff_t difference_type;
2465 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2467 if (!
regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags))
2498 {
return !(*
this == __rhs); }
2505 {
return _M_match; }
2512 {
return &_M_match; }
2534 const regex_type* _M_pregex;
2539 typedef regex_iterator<const char*> cregex_iterator;
2540 typedef regex_iterator<string::const_iterator> sregex_iterator;
2541 #ifdef _GLIBCXX_USE_WCHAR_T 2542 typedef regex_iterator<const wchar_t*> wcregex_iterator;
2543 typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
2554 template<
typename _Bi_iter,
2555 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2556 typename _Rx_traits = regex_traits<_Ch_type> >
2562 typedef std::ptrdiff_t difference_type;
2576 : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr),
2601 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2602 { _M_init(__a, __b); }
2618 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2619 { _M_init(__a, __b); }
2635 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2636 { _M_init(__a, __b); }
2647 template<std::
size_t _Nm>
2650 const int (&__submatches)[_Nm],
2653 : _M_position(__a, __b, __re, __m),
2654 _M_subs(__submatches, __submatches + _Nm), _M_n(0)
2655 { _M_init(__a, __b); }
2670 template <std::
size_t _Nm>
2681 : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
2682 _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
2683 { _M_normalize_result(); }
2703 {
return !(*
this == __rhs); }
2710 {
return *_M_result; }
2717 {
return _M_result; }
2740 _M_init(_Bi_iter __a, _Bi_iter __b);
2743 _M_current_match()
const 2745 if (_M_subs[_M_n] == -1)
2746 return (*_M_position).prefix();
2748 return (*_M_position)[_M_subs[_M_n]];
2752 _M_end_of_seq()
const 2753 {
return _M_result ==
nullptr; }
2757 _M_normalize_result()
2759 if (_M_position != _Position())
2760 _M_result = &_M_current_match();
2762 _M_result = &_M_suffix;
2764 _M_result =
nullptr;
2767 _Position _M_position;
2769 value_type _M_suffix;
2771 const value_type* _M_result;
2783 #ifdef _GLIBCXX_USE_WCHAR_T 2793 _GLIBCXX_END_NAMESPACE_CXX11
2794 _GLIBCXX_END_NAMESPACE_VERSION
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)
_Out_iter format(_Out_iter __out, const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
Primary class template ctype facet.This template class defines classification and conversion function...
size_type max_size() const
Gets the number of matches and submatches.
flag_type flags() const
Gets the flags used to construct the regular expression or in the last call to assign().
string_type format(const char_type *__fmt, match_flag_type __flags=regex_constants::format_default) const
iterator begin() noexcept
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
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...
bool isctype(_Ch_type __c, char_class_type __f) const
Determines if c is a member of an identified class.
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
void swap(basic_regex &__rhs)
Swaps the contents of two regular expression objects.
locale_type getloc() const
Gets the locale currently imbued in the regular expression object.
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...
basic_regex & operator=(const basic_string< _Ch_type, _Ch_traits, _Alloc > &__s)
Replaces a regular expression with a new one constructed from a string.
The results of a match or search operation.
basic_regex & assign(const basic_string< _Ch_type, _Ch_traits, _Alloc > &__s, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object from a string containing a regular expression patt...
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
void swap(match_results &__that)
Swaps the contents of two match_results.
difference_type position(size_type __sub=0) const
Gets the offset of the beginning of the indicated submatch.
bool empty() const
Indicates if the match_results contains no results.
size_type size() const
Gets the number of matches and submatches.
locale_type getloc() const
Gets a copy of the current locale in use by the regex_traits object.
bool operator==(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for equality.
regex_token_iterator & operator++()
Increments a regex_token_iterator.
regex_token_iterator< const wchar_t * > wcregex_token_iterator
Token iterator for C-style NULL-terminated wide strings.
difference_type length() const
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...
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
_GLIBCXX17_INLINE constexpr syntax_option_type egrep
void swap(match_results< _Bi_iter, _Alloc > &__lhs, match_results< _Bi_iter, _Alloc > &__rhs)
Swaps two match results.
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 str() const
Gets the matching sequence as a string.
sub_match< const char * > csub_match
Standard regex submatch over a C-style null-terminated string.
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()
Destroys a basic regular expression.
A standard container which offers fixed time access to individual elements in any order...
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...
_GLIBCXX17_INLINE constexpr syntax_option_type icase
_BiIter second
first is a copy of the first object
regex_token_iterator operator++(int)
Postincrements a regex_token_iterator.
Managing sequences of characters and character-like objects.
regex_iterator & operator=(const regex_iterator &__rhs)=default
Assigns one regex_iterator to another.
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.
size_type size() const noexcept
int compare(const value_type *__s) const
Compares this sub_match to a C-style string.
void resize(size_type __new_size)
Resizes the vector to the specified number of elements.
sub_match< string::const_iterator > ssub_match
Standard regex submatch over a standard string.
bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
basic_regex(initializer_list< _Ch_type > __l, flag_type __f=ECMAScript)
Constructs a basic regular expression from an initializer list.
static std::size_t length(const char_type *__p)
Gives the length of a C-style string starting at __p.
regex_traits()
Constructs a default traits object.
const_reference operator[](size_type __sub) const
Gets a sub_match reference for the match or submatch.
const_reference prefix() const
Gets a sub_match representing the match prefix.
bool empty() const noexcept
const _CharT * data() const noexcept
Return const pointer to contents.
Takes a regex and an input string and does the matching.
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)
bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
_BiIter first
second_type is the second bound type
const_iterator begin() const
Gets an iterator to the start of the sub_match collection.
_GLIBCXX17_INLINE constexpr syntax_option_type ECMAScript
locale_type imbue(locale_type __loc)
Imbues the regular expression object with the given locale.
basic_regex< char > regex
Standard regular expressions.
bool operator!=(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for inequality.
sub_match< const wchar_t * > wcsub_match
Regex submatch over a C-style null-terminated wide string.
bool equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
Tests a range for element-wise equality.
string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
Gets a collation element by name.
allocator_type get_allocator() const
Gets a copy of the allocator.
string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence, independent of case.
bool operator==(const regex_iterator &__rhs) const
Tests the equivalence of two regex iterators.
char_type translate_nocase(char_type __c) const
Translates a character into a case-insensitive equivalent.
basic_regex & assign(const basic_regex &__rhs)
the real assignment operator.
regex_iterator()
Provides a singular iterator, useful for indicating one-past-the-end of a range.
const value_type * operator->() const
Selects a regex_iterator member.
basic_regex & assign(basic_regex &&__rhs) noexcept
The move-assignment operator.
Facet for localized string comparison.
const value_type & operator*() const
Dereferences a regex_token_iterator.
bitset< _Nb > operator &(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
difference_type length(size_type __sub=0) const
Gets the length of the indicated submatch.
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)
int compare(const basic_string &__str) const
Compare to a string.
ISO C++ entities toplevel namespace is std.
back_insert_iterator< _Container > back_inserter(_Container &__x)
_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...
_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
const_iterator cend() const
Gets an iterator to one-past-the-end of the collection.
basic_string< char_type, _St, _Sa > format(const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
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)
_GLIBCXX17_INLINE constexpr syntax_option_type nosubs
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
regex_token_iterator(const regex_token_iterator &__rhs)
Copy constructs a regex_token_iterator.
basic_regex & operator=(basic_regex &&__rhs) noexcept
Move-assigns one regular expression to another.
typename _Size< _Alloc, difference_type >::type size_type
The allocator's size type.
bool operator!=(const regex_iterator &__rhs) const
Tests the inequivalence of two regex iterators.
void swap(vector &__x) noexcept
Swaps data with another vector.
string_type transform(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence.
string_type str(size_type __sub=0) const
Gets the match or submatch converted to a string type.
match_results(const _Alloc &__a=_Alloc())
Constructs a default match_results container.
bool ready() const
Indicates if the match_results is ready.
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)
basic_regex< wchar_t > wregex
Standard wide-character regular expressions.
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.
_GLIBCXX17_INLINE constexpr syntax_option_type basic
Describes aspects of a regular expression.
~match_results()
Destroys a match_results object.
basic_regex(const std::basic_string< _Ch_type, _Ch_traits, _Ch_alloc > &__s, flag_type __f=ECMAScript)
Constructs a basic regular expression from the string s interpreted according to the flags in f...
basic_regex & assign(initializer_list< _Ch_type > __l, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
regex_token_iterator< const char * > cregex_token_iterator
Token iterator for C-style NULL-terminated strings.
size_type max_size() const noexcept
match_flag_type
This is a bitmask type indicating regex matching rules.
basic_regex & operator=(initializer_list< _Ch_type > __l)
Replaces a regular expression with a new one constructed from an initializer list.
const value_type & operator*() const
Dereferences a regex_iterator.
syntax_option_type
This is a bitmask type indicating how to interpret the regex.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
_GLIBCXX17_INLINE constexpr syntax_option_type awk
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.
Struct holding two objects of arbitrary type.
Forward iterators support a superset of input iterator operations.
char_type translate(char_type __c) const
Performs the identity translation.
_GLIBCXX17_INLINE constexpr syntax_option_type extended
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...
regex_iterator & operator++()
Increments a regex_iterator.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
basic_regex & assign(_InputIterator __first, _InputIterator __last, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
_GLIBCXX17_INLINE constexpr syntax_option_type optimize
const value_type * operator->() const
Selects a regex_token_iterator member.
locale_type imbue(locale_type __loc)
Imbues the regex_traits object with a copy of a new locale.
regex_token_iterator< string::const_iterator > sregex_token_iterator
Token iterator for standard strings.
sub_match< wstring::const_iterator > wssub_match
Regex submatch over a standard wide string.
_GLIBCXX17_INLINE constexpr match_flag_type format_default
A smart pointer with reference-counted copy semantics.
const_iterator cbegin() const
Gets an iterator to the start of the sub_match collection.
_GLIBCXX17_INLINE constexpr syntax_option_type grep
_GLIBCXX17_INLINE constexpr match_flag_type match_default
int compare(const string_type &__s) const
Compares this sub_match to a string.
regex_token_iterator()
Default constructs a regex_token_iterator.
regex_iterator operator++(int)
Postincrements a regex_iterator.
bool operator!=(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for inequality.
const_iterator end() const
Gets an iterator to one-past-the-end of the collection.
_GLIBCXX17_INLINE constexpr syntax_option_type collate
regex_token_iterator< wstring::const_iterator > wsregex_token_iterator
Token iterator for standard wide-character strings.
unsigned int mark_count() const
Gets the number of marked subexpressions within the regular expression.
match_results & operator=(const match_results &__rhs)=default
Assigns rhs to *this.
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.