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
42 _GLIBCXX_END_NAMESPACE_VERSION
46 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48 enum class _RegexExecutorPolicy : int
49 { _S_auto, _S_alternate };
51 template<
typename _BiIter,
typename _Alloc,
52 typename _CharT,
typename _TraitsT,
53 _RegexExecutorPolicy __policy,
56 __regex_algo_impl(_BiIter __s,
62 template<
typename,
typename,
typename,
bool>
65 _GLIBCXX_END_NAMESPACE_VERSION
68 _GLIBCXX_BEGIN_NAMESPACE_VERSION
69 _GLIBCXX_BEGIN_NAMESPACE_CXX11
86 template<
typename _Ch_type>
90 typedef _Ch_type char_type;
96 typedef std::ctype_base::mask _BaseType;
98 unsigned char _M_extended;
99 static constexpr
unsigned char _S_under = 1 << 0;
100 static constexpr
unsigned char _S_valid_mask = 0x1;
102 constexpr _RegexMask(_BaseType __base = 0,
103 unsigned char __extended = 0)
104 : _M_base(__base), _M_extended(__extended)
110 return _RegexMask(_M_base & __other._M_base,
111 _M_extended & __other._M_extended);
117 return _RegexMask(_M_base | __other._M_base,
118 _M_extended | __other._M_extended);
124 return _RegexMask(_M_base ^ __other._M_base,
125 _M_extended ^ __other._M_extended);
130 {
return _RegexMask(~_M_base, ~_M_extended); }
133 operator&=(_RegexMask __other)
134 {
return *
this = (*this) & __other; }
137 operator|=(_RegexMask __other)
138 {
return *
this = (*this) | __other; }
141 operator^=(_RegexMask __other)
142 {
return *
this = (*this) ^ __other; }
145 operator==(_RegexMask __other)
const 147 return (_M_extended & _S_valid_mask)
148 == (__other._M_extended & _S_valid_mask)
149 && _M_base == __other._M_base;
153 operator!=(_RegexMask __other)
const 154 {
return !((*this) == __other); }
158 typedef _RegexMask char_class_type;
178 {
return string_type::traits_type::length(__p); }
204 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
205 return __fctyp.tolower(__c);
228 template<
typename _Fwd_iter>
233 const __collate_type& __fclt(use_facet<__collate_type>(_M_locale));
234 string_type __s(__first, __last);
235 return __fclt.transform(__s.
data(), __s.
data() + __s.
size());
252 template<
typename _Fwd_iter>
263 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
266 return this->transform(__s.
data(), __s.
data() + __s.
size());
280 template<
typename _Fwd_iter>
282 lookup_collatename(_Fwd_iter __first, _Fwd_iter __last)
const;
321 template<
typename _Fwd_iter>
323 lookup_classname(_Fwd_iter __first, _Fwd_iter __last,
324 bool __icase =
false)
const;
339 isctype(_Ch_type __c, char_class_type __f)
const;
352 value(_Ch_type __ch,
int __radix)
const;
368 std::swap(_M_locale, __loc);
378 {
return _M_locale; }
381 locale_type _M_locale;
392 template<
typename _Ch_type,
typename _Rx_traits = regex_traits<_Ch_type>>
396 static_assert(is_same<_Ch_type, typename _Rx_traits::char_type>::value,
397 "regex traits class must have the same char_type");
400 typedef _Ch_type value_type;
401 typedef _Rx_traits traits_type;
402 typedef typename traits_type::string_type
string_type;
404 typedef typename traits_type::locale_type
locale_type;
429 : _M_flags(ECMAScript), _M_loc(), _M_automaton(nullptr)
461 flag_type __f = ECMAScript)
488 template<
typename _Ch_traits,
typename _Ch_alloc>
492 flag_type __f = ECMAScript)
493 :
basic_regex(__s.data(), __s.data() + __s.size(), __f)
509 template<
typename _FwdIter>
511 flag_type __f = ECMAScript)
538 {
return this->assign(__rhs); }
545 {
return this->assign(std::move(__rhs)); }
556 {
return this->assign(__p); }
568 {
return this->assign(__l.begin(), __l.end()); }
576 template<
typename _Ch_traits,
typename _Alloc>
579 {
return this->assign(__s); }
622 assign(
const _Ch_type* __p, flag_type __flags = ECMAScript)
623 {
return this->assign(string_type(__p), __flags); }
639 assign(
const _Ch_type* __p, std::size_t __len, flag_type __flags)
640 {
return this->assign(string_type(__p, __len), __flags); }
653 template<
typename _Ch_traits,
typename _Alloc>
656 flag_type __flags = ECMAScript)
675 template<
typename _InputIterator>
677 assign(_InputIterator __first, _InputIterator __last,
678 flag_type __flags = ECMAScript)
679 {
return this->assign(string_type(__first, __last), __flags); }
694 {
return this->assign(__l.begin(), __l.end(), __flags); }
705 return _M_automaton->_M_sub_count() - 1;
726 std::swap(__loc, _M_loc);
727 _M_automaton.reset();
748 std::swap(_M_flags, __rhs._M_flags);
749 std::swap(_M_loc, __rhs._M_loc);
750 std::swap(_M_automaton, __rhs._M_automaton);
753 #ifdef _GLIBCXX_DEBUG 756 { _M_automaton->_M_dot(__ostr); }
762 template<
typename _FwdIter>
763 basic_regex(_FwdIter __first, _FwdIter __last, locale_type __loc,
765 : _M_flags((__f & (ECMAScript | basic | extended | awk | grep | egrep))
766 ? __f : (__f | ECMAScript)),
767 _M_loc(std::move(__loc)),
768 _M_automaton(__detail::__compile_nfa<_FwdIter, _Rx_traits>(
769 std::move(__first), std::move(__last), _M_loc, _M_flags))
772 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
773 __detail::_RegexExecutorPolicy,
bool>
774 friend bool __detail::
775 #if _GLIBCXX_INLINE_VERSION 782 template<
typename,
typename,
typename,
bool>
787 _AutomatonPtr _M_automaton;
793 #ifdef _GLIBCXX_USE_WCHAR_T 805 template<
typename _Ch_type,
typename _Rx_traits>
809 { __lhs.
swap(__rhs); }
825 template<
typename _BiIter>
828 typedef iterator_traits<_BiIter> __iter_traits;
831 typedef typename __iter_traits::value_type value_type;
832 typedef typename __iter_traits::difference_type difference_type;
833 typedef _BiIter iterator;
845 {
return this->matched ?
std::distance(this->first, this->second) : 0; }
857 operator string_type()
const 860 ? string_type(this->first, this->second)
873 ? string_type(this->first, this->second)
888 {
return this->str().compare(__s.
str()); }
901 {
return this->str().compare(__s); }
914 {
return this->str().compare(__s); }
924 #ifdef _GLIBCXX_USE_WCHAR_T 940 template<
typename _BiIter>
943 {
return __lhs.
compare(__rhs) == 0; }
951 template<
typename _BiIter>
954 {
return __lhs.
compare(__rhs) != 0; }
962 template<
typename _BiIter>
965 {
return __lhs.
compare(__rhs) < 0; }
973 template<
typename _BiIter>
976 {
return __lhs.
compare(__rhs) <= 0; }
984 template<
typename _BiIter>
987 {
return __lhs.
compare(__rhs) >= 0; }
995 template<
typename _BiIter>
998 {
return __lhs.
compare(__rhs) > 0; }
1001 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1003 typename iterator_traits<_Bi_iter>::value_type,
1004 _Ch_traits, _Ch_alloc>;
1013 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1029 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1033 {
return !(__lhs == __rhs); }
1041 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1043 operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1047 return __rhs.
compare(string_type(__lhs.data(), __lhs.size())) > 0;
1056 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1060 {
return __rhs < __lhs; }
1068 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1072 {
return !(__lhs < __rhs); }
1080 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1082 operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1084 {
return !(__rhs < __lhs); }
1093 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,
1127 return __lhs.
compare(string_type(__rhs.data(), __rhs.size())) < 0;
1136 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1140 {
return __rhs < __lhs; }
1148 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1152 {
return !(__lhs < __rhs); }
1160 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1162 operator<=(const sub_match<_Bi_iter>& __lhs,
1164 {
return !(__rhs < __lhs); }
1173 template<
typename _Bi_iter>
1175 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1177 {
return __rhs.
compare(__lhs) == 0; }
1186 template<
typename _Bi_iter>
1188 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1190 {
return !(__lhs == __rhs); }
1198 template<
typename _Bi_iter>
1200 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1202 {
return __rhs.
compare(__lhs) > 0; }
1210 template<
typename _Bi_iter>
1212 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1214 {
return __rhs < __lhs; }
1222 template<
typename _Bi_iter>
1224 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1226 {
return !(__lhs < __rhs); }
1234 template<
typename _Bi_iter>
1236 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1238 {
return !(__rhs < __lhs); }
1247 template<
typename _Bi_iter>
1250 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1251 {
return __lhs.
compare(__rhs) == 0; }
1260 template<
typename _Bi_iter>
1263 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1264 {
return !(__lhs == __rhs); }
1272 template<
typename _Bi_iter>
1274 operator<(const sub_match<_Bi_iter>& __lhs,
1275 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1276 {
return __lhs.
compare(__rhs) < 0; }
1284 template<
typename _Bi_iter>
1287 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1288 {
return __rhs < __lhs; }
1296 template<
typename _Bi_iter>
1299 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1300 {
return !(__lhs < __rhs); }
1308 template<
typename _Bi_iter>
1310 operator<=(const sub_match<_Bi_iter>& __lhs,
1311 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1312 {
return !(__rhs < __lhs); }
1321 template<
typename _Bi_iter>
1323 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1327 return __rhs.
compare(string_type(1, __lhs)) == 0;
1337 template<
typename _Bi_iter>
1339 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1341 {
return !(__lhs == __rhs); }
1349 template<
typename _Bi_iter>
1351 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1355 return __rhs.
compare(string_type(1, __lhs)) > 0;
1364 template<
typename _Bi_iter>
1366 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1368 {
return __rhs < __lhs; }
1376 template<
typename _Bi_iter>
1378 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1380 {
return !(__lhs < __rhs); }
1388 template<
typename _Bi_iter>
1390 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1392 {
return !(__rhs < __lhs); }
1401 template<
typename _Bi_iter>
1404 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1407 return __lhs.
compare(string_type(1, __rhs)) == 0;
1417 template<
typename _Bi_iter>
1420 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1421 {
return !(__lhs == __rhs); }
1429 template<
typename _Bi_iter>
1431 operator<(const sub_match<_Bi_iter>& __lhs,
1432 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1435 return __lhs.
compare(string_type(1, __rhs)) < 0;
1444 template<
typename _Bi_iter>
1447 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1448 {
return __rhs < __lhs; }
1456 template<
typename _Bi_iter>
1459 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1460 {
return !(__lhs < __rhs); }
1468 template<
typename _Bi_iter>
1470 operator<=(const sub_match<_Bi_iter>& __lhs,
1471 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1472 {
return !(__rhs < __lhs); }
1482 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1485 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1487 {
return __os << __m.
str(); }
1513 template<
typename _Bi_iter,
1516 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1536 typedef std::iterator_traits<_Bi_iter> __iter_traits;
1545 typedef const value_type& const_reference;
1546 typedef const_reference reference;
1547 typedef typename _Base_type::const_iterator const_iterator;
1549 typedef typename __iter_traits::difference_type difference_type;
1551 typedef _Alloc allocator_type;
1552 typedef typename __iter_traits::value_type char_type;
1607 bool ready()
const {
return !_Base_type::empty(); }
1625 {
return _Base_type::empty() ? 0 : _Base_type::size() - 3; }
1629 {
return _Base_type::max_size(); }
1638 {
return size() == 0; }
1657 {
return (*
this)[__sub].length(); }
1684 str(size_type __sub = 0)
const 1685 {
return string_type((*
this)[__sub]); }
1701 __glibcxx_assert( ready() );
1702 return __sub < size()
1703 ? _Base_type::operator[](__sub)
1704 : _M_unmatched_sub();
1718 __glibcxx_assert( ready() );
1719 return !empty() ? _M_prefix() : _M_unmatched_sub();
1733 __glibcxx_assert( ready() );
1734 return !empty() ? _M_suffix() : _M_unmatched_sub();
1749 {
return this->
begin(); }
1763 {
return this->
end(); }
1780 template<
typename _Out_iter>
1782 format(_Out_iter __out,
const char_type* __fmt_first,
1783 const char_type* __fmt_last,
1789 template<
typename _Out_iter,
typename _St,
typename _Sa>
1794 return format(__out, __fmt.
data(), __fmt.
data() + __fmt.
size(),
1801 template<
typename _St,
typename _Sa>
1818 string_type __result;
1838 {
return _Base_type::get_allocator(); }
1855 swap(_M_begin, __that._M_begin);
1860 template<
typename,
typename,
typename,
bool>
1863 template<
typename,
typename,
typename>
1866 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
1867 __detail::_RegexExecutorPolicy,
bool>
1868 friend bool __detail::
1869 #if _GLIBCXX_INLINE_VERSION 1877 _M_resize(
unsigned int __size)
1878 { _Base_type::resize(__size + 3); }
1881 _M_unmatched_sub()
const 1882 {
return _Base_type::operator[](_Base_type::size() - 3); }
1886 {
return _Base_type::operator[](_Base_type::size() - 3); }
1890 {
return _Base_type::operator[](_Base_type::size() - 2); }
1894 {
return _Base_type::operator[](_Base_type::size() - 2); }
1898 {
return _Base_type::operator[](_Base_type::size() - 1); }
1902 {
return _Base_type::operator[](_Base_type::size() - 1); }
1909 #ifdef _GLIBCXX_USE_WCHAR_T 1920 template<
typename _Bi_iter,
typename _Alloc>
1944 template<
typename _Bi_iter,
class _Alloc>
1948 {
return !(__m1 == __m2); }
1958 template<
typename _Bi_iter,
typename _Alloc>
1962 { __lhs.
swap(__rhs); }
1964 _GLIBCXX_END_NAMESPACE_CXX11
1987 template<
typename _Bi_iter,
typename _Alloc,
1988 typename _Ch_type,
typename _Rx_traits>
1997 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
1998 __detail::_RegexExecutorPolicy::_S_auto,
true>
1999 (__s, __e, __m, __re, __flags);
2016 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2024 return regex_match(__first, __last, __what, __re, __flags);
2041 template<
typename _Ch_type,
typename _Alloc,
typename _Rx_traits>
2048 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2064 template<
typename _Ch_traits,
typename _Ch_alloc,
2065 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2069 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2078 template<
typename _Ch_traits,
typename _Ch_alloc,
2079 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2083 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2101 template<
typename _Ch_type,
class _Rx_traits>
2107 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2122 template<
typename _Ch_traits,
typename _Str_allocator,
2123 typename _Ch_type,
typename _Rx_traits>
2145 template<
typename _Bi_iter,
typename _Alloc,
2146 typename _Ch_type,
typename _Rx_traits>
2154 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2155 __detail::_RegexExecutorPolicy::_S_auto,
false>
2156 (__s, __e, __m, __re, __flags);
2170 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2178 return regex_search(__first, __last, __what, __re, __flags);
2193 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2200 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2212 template<
typename _Ch_type,
typename _Rx_traits>
2218 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2230 template<
typename _Ch_traits,
typename _String_allocator,
2231 typename _Ch_type,
typename _Rx_traits>
2234 _String_allocator>& __s,
2238 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2252 template<
typename _Ch_traits,
typename _Ch_alloc,
2253 typename _Alloc,
typename _Ch_type,
2254 typename _Rx_traits>
2258 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2267 template<
typename _Ch_traits,
typename _Ch_alloc,
2268 typename _Alloc,
typename _Ch_type,
2269 typename _Rx_traits>
2273 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2292 template<
typename _Out_iter,
typename _Bi_iter,
2293 typename _Rx_traits,
typename _Ch_type,
2294 typename _St,
typename _Sa>
2318 template<
typename _Out_iter,
typename _Bi_iter,
2319 typename _Rx_traits,
typename _Ch_type>
2321 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
2323 const _Ch_type* __fmt,
2338 template<
typename _Rx_traits,
typename _Ch_type,
2339 typename _St,
typename _Sa,
typename _Fst,
typename _Fsa>
2349 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2364 template<
typename _Rx_traits,
typename _Ch_type,
2365 typename _St,
typename _Sa>
2369 const _Ch_type* __fmt,
2375 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2390 template<
typename _Rx_traits,
typename _Ch_type,
2391 typename _St,
typename _Sa>
2402 __e, __fmt, __flags);
2417 template<
typename _Rx_traits,
typename _Ch_type>
2421 const _Ch_type* __fmt,
2428 __e, __fmt, __flags);
2434 _GLIBCXX_BEGIN_NAMESPACE_CXX11
2441 template<
typename _Bi_iter,
2442 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2449 typedef std::ptrdiff_t difference_type;
2450 typedef const value_type*
pointer;
2451 typedef const value_type& reference;
2472 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2474 if (!
regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags))
2505 {
return !(*
this == __rhs); }
2512 {
return _M_match; }
2519 {
return &_M_match; }
2541 const regex_type* _M_pregex;
2548 #ifdef _GLIBCXX_USE_WCHAR_T 2561 template<
typename _Bi_iter,
2562 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2569 typedef std::ptrdiff_t difference_type;
2570 typedef const value_type*
pointer;
2571 typedef const value_type& reference;
2583 : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr),
2608 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2609 { _M_init(__a, __b); }
2621 const regex_type& __re,
2625 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2626 { _M_init(__a, __b); }
2638 const regex_type& __re,
2642 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2643 { _M_init(__a, __b); }
2654 template<std::
size_t _Nm>
2656 const regex_type& __re,
2657 const int (&__submatches)[_Nm],
2660 : _M_position(__a, __b, __re, __m),
2661 _M_subs(__submatches, __submatches + _Nm), _M_n(0)
2662 { _M_init(__a, __b); }
2677 template <std::
size_t _Nm>
2688 : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
2689 _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
2690 { _M_normalize_result(); }
2710 {
return !(*
this == __rhs); }
2717 {
return *_M_result; }
2724 {
return _M_result; }
2747 _M_init(_Bi_iter __a, _Bi_iter __b);
2750 _M_current_match()
const 2752 if (_M_subs[_M_n] == -1)
2753 return (*_M_position).prefix();
2755 return (*_M_position)[_M_subs[_M_n]];
2759 _M_end_of_seq()
const 2760 {
return _M_result ==
nullptr; }
2764 _M_normalize_result()
2766 if (_M_position != _Position())
2767 _M_result = &_M_current_match();
2769 _M_result = &_M_suffix;
2771 _M_result =
nullptr;
2774 _Position _M_position;
2776 value_type _M_suffix;
2778 const value_type* _M_result;
2790 #ifdef _GLIBCXX_USE_WCHAR_T 2800 _GLIBCXX_END_NAMESPACE_CXX11
2801 _GLIBCXX_END_NAMESPACE_VERSION
regex_iterator()
Provides a singular iterator, useful for indicating one-past-the-end of a range.
basic_regex & operator=(initializer_list< _Ch_type > __l)
Replaces a regular expression with a new one constructed from an initializer list.
locale_type getloc() const
Gets a copy of the current locale in use by the regex_traits object.
locale_type imbue(locale_type __loc)
Imbues the regular expression object with the given locale.
sub_match< wstring::const_iterator > wssub_match
Regex submatch over a standard wide string.
regex_iterator operator++(int)
Postincrements a regex_iterator.
regex_token_iterator(const regex_token_iterator &__rhs)
Copy constructs a regex_token_iterator.
locale_type imbue(locale_type __loc)
Imbues the regex_traits object with a copy of a new locale.
flag_type flags() const
Gets the flags used to construct the regular expression or in the last call to assign().
basic_regex & operator=(basic_regex &&__rhs) noexcept
Move-assigns one regular expression to another.
const_iterator cend() const
Gets an iterator to one-past-the-end of the collection.
size_type max_size() const
Gets the number of matches and submatches.
Takes a regex and an input string and does the matching.
The standard allocator, as per [20.4].
basic_regex< wchar_t > wregex
Standard wide-character regular expressions.
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)
difference_type length(size_type __sub=0) const
Gets the length of the indicated submatch.
const value_type & operator*() const
Dereferences a regex_iterator.
_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...
Primary class template ctype facet.This template class defines classification and conversion function...
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...
const_reference operator[](size_type __sub) const
Gets a sub_match reference for the match or submatch.
_GLIBCXX17_INLINE constexpr syntax_option_type egrep
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)
const _CharT * data() const noexcept
Return const pointer to contents.
Managing sequences of characters and character-like objects.
unsigned int mark_count() const
Gets the number of marked subexpressions within the regular expression.
~match_results()
Destroys a match_results object.
string_type str(size_type __sub=0) const
Gets the match or submatch converted to a string type.
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 grep
bool operator!=(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for inequality.
int compare(const basic_string &__str) const
Compare to a string.
match_results(const _Alloc &__a=_Alloc())
Constructs a default match_results container.
_GLIBCXX17_INLINE constexpr syntax_option_type ECMAScript
regex_token_iterator operator++(int)
Postincrements a regex_token_iterator.
_GLIBCXX17_INLINE constexpr syntax_option_type extended
~basic_regex()
Destroys a basic regular expression.
size_type size() const
Gets the number of matches and submatches.
size_type size() const noexcept
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
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...
back_insert_iterator< _Container > back_inserter(_Container &__x)
regex_token_iterator< const wchar_t * > wcregex_token_iterator
Token iterator for C-style NULL-terminated wide strings.
A standard container which offers fixed time access to individual elements in any order...
_GLIBCXX17_INLINE constexpr match_flag_type 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
difference_type position(size_type __sub=0) const
Gets the offset of the beginning of the indicated submatch.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
_GLIBCXX17_INLINE constexpr syntax_option_type nosubs
regex_token_iterator< string::const_iterator > sregex_token_iterator
Token iterator for standard strings.
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...
The results of a match or search operation.
basic_regex & assign(const basic_regex &__rhs)
the real assignment operator.
char_type translate(char_type __c) const
Performs the identity translation.
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...
ISO C++ entities toplevel namespace is std.
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...
_GLIBCXX17_INLINE constexpr syntax_option_type collate
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.
_GLIBCXX17_INLINE constexpr syntax_option_type awk
regex_token_iterator< const char * > cregex_token_iterator
Token iterator for C-style NULL-terminated strings.
int compare(const value_type *__s) const
Compares this sub_match to a C-style string.
bool equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
Tests a range for element-wise equality.
_GLIBCXX17_INLINE constexpr syntax_option_type icase
bool ready() const
Indicates if the match_results is ready.
A smart pointer with reference-counted copy semantics.
regex_token_iterator< wstring::const_iterator > wsregex_token_iterator
Token iterator for standard wide-character strings.
typename _Size< _Alloc, difference_type >::type size_type
The allocator's size type.
const value_type & operator*() const
Dereferences a regex_token_iterator.
Basis for explicit traits specializations.
allocator_type get_allocator() const
Gets a copy of the allocator.
void swap(match_results &__that)
Swaps the contents of two match_results.
Describes aspects of a regular expression.
regex_token_iterator()
Default constructs a regex_token_iterator.
void swap(match_results< _Bi_iter, _Alloc > &__lhs, match_results< _Bi_iter, _Alloc > &__rhs)
Swaps two match results.
sub_match< const wchar_t * > wcsub_match
Regex submatch over a C-style null-terminated wide string.
bool operator==(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for equality.
syntax_option_type
This is a bitmask type indicating how to interpret the regex.
bool operator!=(const regex_iterator &__rhs) const
Tests the inequivalence of two regex iterators.
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
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 basic
Struct holding two objects of arbitrary type.
difference_type length() const
int compare(const string_type &__s) const
Compares this sub_match to a string.
basic_string< char_type, _St, _Sa > format(const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
const_reference suffix() const
Gets a sub_match representing the match suffix.
match_flag_type
This is a bitmask type indicating regex matching rules.
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.
bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
regex_traits()
Constructs a default traits object.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
_GLIBCXX17_INLINE constexpr match_flag_type format_default
basic_regex & assign(initializer_list< _Ch_type > __l, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
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...
const_iterator cbegin() const
Gets an iterator to the start of the sub_match collection.
Forward iterators support a superset of input iterator operations.
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, 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)
basic_regex< char > regex
Standard regular expressions.
sub_match< string::const_iterator > ssub_match
Standard regex submatch over a standard string.
basic_regex(_FwdIter __first, _FwdIter __last, flag_type __f=ECMAScript)
Constructs a basic regular expression from the range [first, last) interpreted according to the flags...
basic_regex & assign(const basic_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...
char_type translate_nocase(char_type __c) const
Translates a character into a case-insensitive equivalent.
const_reference prefix() const
Gets a sub_match representing the match prefix.
string_type str() const
Gets the matching sequence as a string.
basic_regex & operator=(const _Ch_type *__p)
Replaces a regular expression with a new one constructed from a C-style null-terminated string...
Facet for localized string comparison.
basic_regex & assign(basic_regex &&__rhs) noexcept
The move-assignment operator.
void swap(basic_regex &__rhs)
Swaps the contents of two regular expression objects.
basic_regex & assign(_InputIterator __first, _InputIterator __last, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
bitset< _Nb > operator&(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
const value_type * operator->() const
Selects a regex_iterator member.
string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence, independent of case.
string_type format(const char_type *__fmt, match_flag_type __flags=regex_constants::format_default) const
basic_regex & operator=(const basic_regex &__rhs)
Assigns one regular expression to another.
bool empty() const
Indicates if the match_results contains no results.
regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, const int(&__submatches)[_Nm], regex_constants::match_flag_type __m=regex_constants::match_default)
bool operator!=(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for inequality.
string_type transform(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence.
int compare(const sub_match &__s) const
Compares this and another matched sequence.
const value_type * operator->() const
Selects a regex_token_iterator member.
basic_regex & operator=(const basic_string< _Ch_type, _Ch_traits, _Alloc > &__s)
Replaces a regular expression with a new one constructed from a string.
_GLIBCXX17_INLINE constexpr syntax_option_type optimize
const_iterator begin() const
Gets an iterator to the start of the sub_match collection.