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));
228 string_type __s(__first, __last);
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));
260 return this->transform(__s.
data(), __s.
data() + __s.
size());
274 template<
typename _Fwd_iter>
276 lookup_collatename(_Fwd_iter __first, _Fwd_iter __last)
const;
315 template<
typename _Fwd_iter>
317 lookup_classname(_Fwd_iter __first, _Fwd_iter __last,
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>>
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)
455 flag_type __f = ECMAScript)
482 template<
typename _Ch_traits,
typename _Ch_alloc>
486 flag_type __f = ECMAScript)
487 :
basic_regex(__s.data(), __s.data() + __s.size(), __f)
503 template<
typename _FwdIter>
505 flag_type __f = ECMAScript)
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); }
616 assign(
const _Ch_type* __p, flag_type __flags = ECMAScript)
617 {
return this->assign(string_type(__p), __flags); }
633 assign(
const _Ch_type* __p, std::size_t __len, flag_type __flags)
634 {
return this->assign(string_type(__p, __len), __flags); }
647 template<
typename _Ch_traits,
typename _Alloc>
650 flag_type __flags = ECMAScript)
669 template<
typename _InputIterator>
671 assign(_InputIterator __first, _InputIterator __last,
672 flag_type __flags = ECMAScript)
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>
771 template<
typename,
typename,
typename,
bool>
776 _AutomatonPtr _M_automaton;
779 #if __cplusplus < 201703L 780 template<
typename _Ch,
typename _Tr>
784 template<
typename _Ch,
typename _Tr>
788 template<
typename _Ch,
typename _Tr>
792 template<
typename _Ch,
typename _Tr>
796 template<
typename _Ch,
typename _Tr>
800 template<
typename _Ch,
typename _Tr>
804 template<
typename _Ch,
typename _Tr>
808 template<
typename _Ch,
typename _Tr>
812 template<
typename _Ch,
typename _Tr>
816 template<
typename _Ch,
typename _Tr>
821 #if __cpp_deduction_guides >= 201606 822 template<
typename _ForwardIterator>
825 ->
basic_regex<
typename iterator_traits<_ForwardIterator>::value_type>;
831 #ifdef _GLIBCXX_USE_WCHAR_T 843 template<
typename _Ch_type,
typename _Rx_traits>
847 { __lhs.
swap(__rhs); }
863 template<
typename _BiIter>
866 typedef iterator_traits<_BiIter> __iter_traits;
869 typedef typename __iter_traits::value_type value_type;
870 typedef typename __iter_traits::difference_type difference_type;
871 typedef _BiIter iterator;
883 {
return this->matched ?
std::distance(this->first, this->second) : 0; }
895 operator string_type()
const 898 ? string_type(this->first, this->second)
911 ? string_type(this->first, this->second)
926 {
return this->str().compare(__s.
str()); }
939 {
return this->str().compare(__s); }
952 {
return this->str().compare(__s); }
962 #ifdef _GLIBCXX_USE_WCHAR_T 978 template<
typename _BiIter>
981 {
return __lhs.
compare(__rhs) == 0; }
989 template<
typename _BiIter>
992 {
return __lhs.
compare(__rhs) != 0; }
1000 template<
typename _BiIter>
1003 {
return __lhs.
compare(__rhs) < 0; }
1011 template<
typename _BiIter>
1014 {
return __lhs.
compare(__rhs) <= 0; }
1022 template<
typename _BiIter>
1025 {
return __lhs.
compare(__rhs) >= 0; }
1033 template<
typename _BiIter>
1036 {
return __lhs.
compare(__rhs) > 0; }
1039 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1041 typename iterator_traits<_Bi_iter>::value_type,
1042 _Ch_traits, _Ch_alloc>;
1051 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1067 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1071 {
return !(__lhs == __rhs); }
1079 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1081 operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1085 return __rhs.
compare(string_type(__lhs.data(), __lhs.size())) > 0;
1094 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1098 {
return __rhs < __lhs; }
1106 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1110 {
return !(__lhs < __rhs); }
1118 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1120 operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1122 {
return !(__rhs < __lhs); }
1131 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1147 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1151 {
return !(__lhs == __rhs); }
1159 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1161 operator<(const sub_match<_Bi_iter>& __lhs,
1165 return __lhs.
compare(string_type(__rhs.data(), __rhs.size())) < 0;
1174 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1178 {
return __rhs < __lhs; }
1186 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1190 {
return !(__lhs < __rhs); }
1198 template<
typename _Bi_iter,
class _Ch_traits,
class _Ch_alloc>
1200 operator<=(const sub_match<_Bi_iter>& __lhs,
1202 {
return !(__rhs < __lhs); }
1211 template<
typename _Bi_iter>
1213 operator==(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1215 {
return __rhs.
compare(__lhs) == 0; }
1224 template<
typename _Bi_iter>
1226 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1228 {
return !(__lhs == __rhs); }
1236 template<
typename _Bi_iter>
1238 operator<(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1240 {
return __rhs.
compare(__lhs) > 0; }
1248 template<
typename _Bi_iter>
1250 operator>(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1252 {
return __rhs < __lhs; }
1260 template<
typename _Bi_iter>
1262 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1264 {
return !(__lhs < __rhs); }
1272 template<
typename _Bi_iter>
1274 operator<=(typename iterator_traits<_Bi_iter>::value_type
const* __lhs,
1276 {
return !(__rhs < __lhs); }
1285 template<
typename _Bi_iter>
1288 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1289 {
return __lhs.
compare(__rhs) == 0; }
1298 template<
typename _Bi_iter>
1301 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1302 {
return !(__lhs == __rhs); }
1310 template<
typename _Bi_iter>
1312 operator<(const sub_match<_Bi_iter>& __lhs,
1313 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1314 {
return __lhs.
compare(__rhs) < 0; }
1322 template<
typename _Bi_iter>
1325 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1326 {
return __rhs < __lhs; }
1334 template<
typename _Bi_iter>
1337 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1338 {
return !(__lhs < __rhs); }
1346 template<
typename _Bi_iter>
1348 operator<=(const sub_match<_Bi_iter>& __lhs,
1349 typename iterator_traits<_Bi_iter>::value_type
const* __rhs)
1350 {
return !(__rhs < __lhs); }
1359 template<
typename _Bi_iter>
1361 operator==(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1365 return __rhs.
compare(string_type(1, __lhs)) == 0;
1375 template<
typename _Bi_iter>
1377 operator!=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1379 {
return !(__lhs == __rhs); }
1387 template<
typename _Bi_iter>
1389 operator<(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1393 return __rhs.
compare(string_type(1, __lhs)) > 0;
1402 template<
typename _Bi_iter>
1404 operator>(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1406 {
return __rhs < __lhs; }
1414 template<
typename _Bi_iter>
1416 operator>=(
typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1418 {
return !(__lhs < __rhs); }
1426 template<
typename _Bi_iter>
1428 operator<=(typename iterator_traits<_Bi_iter>::value_type
const& __lhs,
1430 {
return !(__rhs < __lhs); }
1439 template<
typename _Bi_iter>
1442 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1445 return __lhs.
compare(string_type(1, __rhs)) == 0;
1455 template<
typename _Bi_iter>
1458 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1459 {
return !(__lhs == __rhs); }
1467 template<
typename _Bi_iter>
1469 operator<(const sub_match<_Bi_iter>& __lhs,
1470 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1473 return __lhs.
compare(string_type(1, __rhs)) < 0;
1482 template<
typename _Bi_iter>
1485 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1486 {
return __rhs < __lhs; }
1494 template<
typename _Bi_iter>
1497 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1498 {
return !(__lhs < __rhs); }
1506 template<
typename _Bi_iter>
1508 operator<=(const sub_match<_Bi_iter>& __lhs,
1509 typename iterator_traits<_Bi_iter>::value_type
const& __rhs)
1510 {
return !(__rhs < __lhs); }
1520 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1523 operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
1525 {
return __os << __m.
str(); }
1551 template<
typename _Bi_iter,
1554 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1574 typedef std::iterator_traits<_Bi_iter> __iter_traits;
1583 typedef const value_type& const_reference;
1584 typedef value_type& reference;
1585 typedef typename _Base_type::const_iterator const_iterator;
1587 typedef typename __iter_traits::difference_type difference_type;
1589 typedef _Alloc allocator_type;
1590 typedef typename __iter_traits::value_type char_type;
1645 bool ready()
const {
return !_Base_type::empty(); }
1663 {
return _Base_type::empty() ? 0 : _Base_type::size() - 3; }
1667 {
return _Base_type::max_size(); }
1676 {
return size() == 0; }
1695 {
return (*
this)[__sub].length(); }
1722 str(size_type __sub = 0)
const 1723 {
return string_type((*
this)[__sub]); }
1739 __glibcxx_assert( ready() );
1740 return __sub < size()
1741 ? _Base_type::operator[](__sub)
1742 : _M_unmatched_sub();
1756 __glibcxx_assert( ready() );
1757 return !empty() ? _M_prefix() : _M_unmatched_sub();
1771 __glibcxx_assert( ready() );
1772 return !empty() ? _M_suffix() : _M_unmatched_sub();
1787 {
return this->
begin(); }
1801 {
return this->
end(); }
1818 template<
typename _Out_iter>
1820 format(_Out_iter __out,
const char_type* __fmt_first,
1821 const char_type* __fmt_last,
1827 template<
typename _Out_iter,
typename _St,
typename _Sa>
1832 return format(__out, __fmt.
data(), __fmt.
data() + __fmt.
size(),
1839 template<
typename _St,
typename _Sa>
1856 string_type __result;
1876 {
return _Base_type::get_allocator(); }
1893 swap(_M_begin, __that._M_begin);
1898 template<
typename,
typename,
typename,
bool>
1901 template<
typename,
typename,
typename>
1904 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
1905 __detail::_RegexExecutorPolicy,
bool>
1912 _M_resize(
unsigned int __size)
1913 { _Base_type::resize(__size + 3); }
1916 _M_unmatched_sub()
const 1917 {
return _Base_type::operator[](_Base_type::size() - 3); }
1921 {
return _Base_type::operator[](_Base_type::size() - 3); }
1925 {
return _Base_type::operator[](_Base_type::size() - 2); }
1929 {
return _Base_type::operator[](_Base_type::size() - 2); }
1933 {
return _Base_type::operator[](_Base_type::size() - 1); }
1937 {
return _Base_type::operator[](_Base_type::size() - 1); }
1944 #ifdef _GLIBCXX_USE_WCHAR_T 1955 template<
typename _Bi_iter,
typename _Alloc>
1979 template<
typename _Bi_iter,
class _Alloc>
1983 {
return !(__m1 == __m2); }
1993 template<
typename _Bi_iter,
typename _Alloc>
1997 { __lhs.
swap(__rhs); }
1999 _GLIBCXX_END_NAMESPACE_CXX11
2022 template<
typename _Bi_iter,
typename _Alloc,
2023 typename _Ch_type,
typename _Rx_traits>
2032 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2033 __detail::_RegexExecutorPolicy::_S_auto,
true>
2034 (__s, __e, __m, __re, __flags);
2051 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2059 return regex_match(__first, __last, __what, __re, __flags);
2076 template<
typename _Ch_type,
typename _Alloc,
typename _Rx_traits>
2083 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2099 template<
typename _Ch_traits,
typename _Ch_alloc,
2100 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2104 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2113 template<
typename _Ch_traits,
typename _Ch_alloc,
2114 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2118 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2136 template<
typename _Ch_type,
class _Rx_traits>
2142 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2157 template<
typename _Ch_traits,
typename _Str_allocator,
2158 typename _Ch_type,
typename _Rx_traits>
2180 template<
typename _Bi_iter,
typename _Alloc,
2181 typename _Ch_type,
typename _Rx_traits>
2189 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2190 __detail::_RegexExecutorPolicy::_S_auto,
false>
2191 (__s, __e, __m, __re, __flags);
2205 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2213 return regex_search(__first, __last, __what, __re, __flags);
2228 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2235 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2247 template<
typename _Ch_type,
typename _Rx_traits>
2253 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2265 template<
typename _Ch_traits,
typename _String_allocator,
2266 typename _Ch_type,
typename _Rx_traits>
2269 _String_allocator>& __s,
2273 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2287 template<
typename _Ch_traits,
typename _Ch_alloc,
2288 typename _Alloc,
typename _Ch_type,
2289 typename _Rx_traits>
2293 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2302 template<
typename _Ch_traits,
typename _Ch_alloc,
2303 typename _Alloc,
typename _Ch_type,
2304 typename _Rx_traits>
2308 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2327 template<
typename _Out_iter,
typename _Bi_iter,
2328 typename _Rx_traits,
typename _Ch_type,
2329 typename _St,
typename _Sa>
2353 template<
typename _Out_iter,
typename _Bi_iter,
2354 typename _Rx_traits,
typename _Ch_type>
2356 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
2358 const _Ch_type* __fmt,
2373 template<
typename _Rx_traits,
typename _Ch_type,
2374 typename _St,
typename _Sa,
typename _Fst,
typename _Fsa>
2384 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2399 template<
typename _Rx_traits,
typename _Ch_type,
2400 typename _St,
typename _Sa>
2404 const _Ch_type* __fmt,
2410 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2425 template<
typename _Rx_traits,
typename _Ch_type,
2426 typename _St,
typename _Sa>
2437 __e, __fmt, __flags);
2452 template<
typename _Rx_traits,
typename _Ch_type>
2456 const _Ch_type* __fmt,
2463 __e, __fmt, __flags);
2469 _GLIBCXX_BEGIN_NAMESPACE_CXX11
2476 template<
typename _Bi_iter,
2477 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2484 typedef std::ptrdiff_t difference_type;
2485 typedef const value_type*
pointer;
2486 typedef const value_type& reference;
2507 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2509 if (!
regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags))
2540 {
return !(*
this == __rhs); }
2547 {
return _M_match; }
2554 {
return &_M_match; }
2576 const regex_type* _M_pregex;
2583 #ifdef _GLIBCXX_USE_WCHAR_T 2596 template<
typename _Bi_iter,
2597 typename _Ch_type =
typename iterator_traits<_Bi_iter>::value_type,
2604 typedef std::ptrdiff_t difference_type;
2605 typedef const value_type*
pointer;
2606 typedef const value_type& reference;
2618 : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr),
2643 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2644 { _M_init(__a, __b); }
2656 const regex_type& __re,
2660 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2661 { _M_init(__a, __b); }
2673 const regex_type& __re,
2677 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2678 { _M_init(__a, __b); }
2689 template<std::
size_t _Nm>
2691 const regex_type& __re,
2692 const int (&__submatches)[_Nm],
2695 : _M_position(__a, __b, __re, __m),
2696 _M_subs(__submatches, __submatches + _Nm), _M_n(0)
2697 { _M_init(__a, __b); }
2712 template <std::
size_t _Nm>
2723 : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
2724 _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
2725 { _M_normalize_result(); }
2745 {
return !(*
this == __rhs); }
2752 {
return *_M_result; }
2759 {
return _M_result; }
2782 _M_init(_Bi_iter __a, _Bi_iter __b);
2785 _M_current_match()
const 2787 if (_M_subs[_M_n] == -1)
2788 return (*_M_position).prefix();
2790 return (*_M_position)[_M_subs[_M_n]];
2794 _M_end_of_seq()
const 2795 {
return _M_result ==
nullptr; }
2799 _M_normalize_result()
2801 if (_M_position != _Position())
2802 _M_result = &_M_current_match();
2804 _M_result = &_M_suffix;
2806 _M_result =
nullptr;
2809 _Position _M_position;
2811 value_type _M_suffix;
2813 const value_type* _M_result;
2825 #ifdef _GLIBCXX_USE_WCHAR_T 2835 _GLIBCXX_END_NAMESPACE_CXX11
2836 _GLIBCXX_END_NAMESPACE_VERSION
The results of a match or search operation.
The standard allocator, as per [20.4].
regex_iterator operator++(int)
Postincrements a regex_iterator.
difference_type length() const
basic_string< char_type, _St, _Sa > format(const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
regex_token_iterator()
Default constructs a regex_token_iterator.
size_type size() const noexcept
basic_regex(const _Ch_type *__p, std::size_t __len, flag_type __f=ECMAScript)
Constructs a basic regular expression from the sequence [p, p + len) interpreted according to the fla...
basic_regex & assign(_InputIterator __first, _InputIterator __last, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
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.
~basic_regex()
Destroys a basic regular expression.
int compare(const basic_string &__str) const
Compare to a string.
difference_type position(size_type __sub=0) const
Gets the offset of the beginning of the indicated submatch.
size_type size() const
Gets the number of matches and submatches.
const_iterator cbegin() const
Gets an iterator to the start of the sub_match collection.
int compare(const string_type &__s) const
Compares this sub_match to a string.
Describes aspects of a regular expression.
basic_regex(initializer_list< _Ch_type > __l, flag_type __f=ECMAScript)
Constructs a basic regular expression from an initializer list.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
unsigned int mark_count() const
Gets the number of marked subexpressions within the regular expression.
const _CharT * data() const noexcept
Return const pointer to contents.
Managing sequences of characters and character-like objects.
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.
string_type format(const char_type *__fmt, match_flag_type __flags=regex_constants::format_default) const
regex_token_iterator< const wchar_t * > wcregex_token_iterator
Token iterator for C-style NULL-terminated wide strings.
string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence, independent of case.
flag_type flags() const
Gets the flags used to construct the regular expression or in the last call to assign().
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
char_type translate(char_type __c) const
Performs the identity translation.
_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.
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)
bool ready() const
Indicates if the match_results is ready.
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)
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...
void swap(basic_regex &__rhs)
Swaps the contents of two regular expression objects.
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
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(const _Ch_type *__p, flag_type __f=ECMAScript)
Constructs a basic regular expression from the sequence [__p, __p + char_traits<_Ch_type>::length(__p...
string_type transform(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence.
sub_match< string::const_iterator > ssub_match
Standard regex submatch over a standard string.
bool operator!=(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for inequality.
bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
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...
const_iterator begin() const
Gets an iterator to the start of the sub_match collection.
locale_type imbue(locale_type __loc)
Imbues the regex_traits object with a copy of a new locale.
bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
const_reference suffix() const
Gets a sub_match representing the match suffix.
const value_type * operator->() const
Selects a regex_token_iterator member.
A standard container which offers fixed time access to individual elements in any order...
const value_type & operator*() const
Dereferences a regex_iterator.
const_iterator cend() const
Gets an iterator to one-past-the-end of the collection.
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...
Facet for localized string comparison.
_GLIBCXX17_INLINE constexpr syntax_option_type ECMAScript
basic_regex< char > regex
Standard regular expressions.
sub_match< const wchar_t * > wcsub_match
Regex submatch over a C-style null-terminated wide string.
regex_iterator()
Provides a singular iterator, useful for indicating one-past-the-end of a range.
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 equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
Tests a range for element-wise equality.
difference_type length(size_type __sub=0) const
Gets the length of the indicated submatch.
bool operator!=(const regex_iterator &__rhs) const
Tests the inequivalence of two regex iterators.
int compare(const sub_match &__s) const
Compares this and another matched sequence.
int compare(const value_type *__s) const
Compares this sub_match to a C-style string.
const_iterator end() const
Gets an iterator to one-past-the-end of the collection.
bitset< _Nb > operator &(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
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...
Forward iterators support a superset of input iterator operations.
size_type max_size() const
Gets the number of matches and submatches.
_Out_iter format(_Out_iter __out, const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
locale_type imbue(locale_type __loc)
Imbues the regular expression object with the given locale.
_GLIBCXX17_INLINE constexpr syntax_option_type nosubs
void swap(match_results &__that)
Swaps the contents of two match_results.
Basis for explicit traits specializations.
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
char_type translate_nocase(char_type __c) const
Translates a character into a case-insensitive equivalent.
static std::size_t length(const char_type *__p)
Gives the length of a C-style string starting at __p.
bool empty() const
Indicates if the match_results contains no results.
basic_regex & assign(const basic_regex &__rhs)
the real assignment operator.
basic_regex & assign(basic_regex &&__rhs) noexcept
The move-assignment operator.
~match_results()
Destroys a match_results object.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
basic_regex< wchar_t > wregex
Standard wide-character regular expressions.
regex_token_iterator(const regex_token_iterator &__rhs)
Copy constructs a regex_token_iterator.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
Takes a regex and an input string and does the matching.
_GLIBCXX17_INLINE constexpr syntax_option_type basic
string_type str(size_type __sub=0) const
Gets the match or submatch converted to a string type.
regex_token_iterator operator++(int)
Postincrements a regex_token_iterator.
regex_token_iterator< const char * > cregex_token_iterator
Token iterator for C-style NULL-terminated strings.
basic_regex & operator=(basic_regex &&__rhs) noexcept
Move-assigns one regular expression to another.
match_flag_type
This is a bitmask type indicating regex matching rules.
const value_type & operator*() const
Dereferences a regex_token_iterator.
locale_type getloc() const
Gets a copy of the current locale in use by the regex_traits object.
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.
A smart pointer with reference-counted copy semantics.
syntax_option_type
This is a bitmask type indicating how to interpret the regex.
typename _Size< _Alloc, difference_type >::type size_type
The allocator's size type.
_GLIBCXX17_INLINE constexpr syntax_option_type awk
regex_traits()
Constructs a default traits object.
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)
_GLIBCXX17_INLINE constexpr syntax_option_type extended
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.
_GLIBCXX17_INLINE constexpr syntax_option_type optimize
locale_type getloc() const
Gets the locale currently imbued in the regular expression object.
Primary class template ctype facet.This template class defines classification and conversion function...
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
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 grep
_GLIBCXX17_INLINE constexpr match_flag_type match_default
allocator_type get_allocator() const
Gets a copy of the allocator.
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...
bool operator!=(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2)
Compares two match_results for inequality.
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 collate
basic_regex & assign(initializer_list< _Ch_type > __l, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
Struct holding two objects of arbitrary type.
regex_token_iterator< wstring::const_iterator > wsregex_token_iterator
Token iterator for standard wide-character strings.
const value_type * operator->() const
Selects a regex_iterator member.
basic_regex & operator=(initializer_list< _Ch_type > __l)
Replaces a regular expression with a new one constructed from an initializer list.