Go to the documentation of this file.
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 { _S_auto, _S_alternate };
47 template<
typename _BiIter,
typename _Alloc,
48 typename _CharT,
typename _TraitsT,
49 _RegexExecutorPolicy __policy,
52 __regex_algo_impl(_BiIter __s,
58 template<
typename,
typename,
typename,
bool>
62 _GLIBCXX_BEGIN_NAMESPACE_CXX11
79 template<
typename _Ch_type>
83 typedef _Ch_type char_type;
89 typedef std::ctype_base::mask _BaseType;
91 unsigned char _M_extended;
92 static constexpr
unsigned char _S_under = 1 << 0;
93 static constexpr
unsigned char _S_valid_mask = 0x1;
95 constexpr _RegexMask(_BaseType
__base = 0,
96 unsigned char __extended = 0)
97 : _M_base(
__base), _M_extended(__extended)
103 return _RegexMask(_M_base & __other._M_base,
104 _M_extended & __other._M_extended);
108 operator|(_RegexMask __other)
const
110 return _RegexMask(_M_base | __other._M_base,
111 _M_extended | __other._M_extended);
115 operator^(_RegexMask __other)
const
117 return _RegexMask(_M_base ^ __other._M_base,
118 _M_extended ^ __other._M_extended);
123 {
return _RegexMask(~_M_base, ~_M_extended); }
126 operator&=(_RegexMask __other)
127 {
return *
this = (*this) & __other; }
130 operator|=(_RegexMask __other)
131 {
return *
this = (*this) | __other; }
134 operator^=(_RegexMask __other)
135 {
return *
this = (*this) ^ __other; }
138 operator==(_RegexMask __other)
const
140 return (_M_extended & _S_valid_mask)
141 == (__other._M_extended & _S_valid_mask)
142 && _M_base == __other._M_base;
146 operator!=(_RegexMask __other)
const
147 {
return !((*this) == __other); }
151 typedef _RegexMask char_class_type;
171 {
return string_type::traits_type::length(__p); }
197 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
198 return __fctyp.tolower(__c);
221 template<
typename _Fwd_iter>
226 const __collate_type& __fclt(use_facet<__collate_type>(_M_locale));
228 return __fclt.transform(__s.
data(), __s.
data() + __s.
size());
245 template<
typename _Fwd_iter>
256 const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
273 template<
typename _Fwd_iter>
314 template<
typename _Fwd_iter>
317 bool __icase =
false)
const;
332 isctype(_Ch_type __c, char_class_type __f)
const;
345 value(_Ch_type __ch,
int __radix)
const;
361 std::swap(_M_locale, __loc);
371 {
return _M_locale; }
374 locale_type _M_locale;
385 template<
typename _Ch_type,
typename _Rx_traits = regex_traits<_Ch_type>>
389 static_assert(is_same<_Ch_type, typename _Rx_traits::char_type>::value,
390 "regex traits class must have the same char_type");
393 typedef _Ch_type value_type;
394 typedef _Rx_traits traits_type;
395 typedef typename traits_type::string_type string_type;
397 typedef typename traits_type::locale_type locale_type;
422 : _M_flags(
ECMAScript), _M_loc(), _M_automaton(nullptr)
481 template<
typename _Ch_traits,
typename _Ch_alloc>
486 :
basic_regex(__s.data(), __s.data() + __s.size(), __f)
502 template<
typename _FwdIter>
531 {
return this->
assign(__rhs); }
549 {
return this->
assign(__p); }
561 {
return this->
assign(__l.begin(), __l.end()); }
569 template<
typename _Ch_traits,
typename _Alloc>
572 {
return this->
assign(__s); }
616 {
return this->
assign(string_type(__p), __flags); }
635 {
return this->
assign(string_type(__p, __len), __flags); }
648 template<
typename _Ch_traits,
typename _Alloc>
670 template<
typename _InputIterator>
672 assign(_InputIterator __first, _InputIterator __last,
674 {
return this->
assign(string_type(__first, __last), __flags); }
689 {
return this->
assign(__l.begin(), __l.end(), __flags); }
700 return _M_automaton->_M_sub_count() - 1;
721 std::swap(__loc, _M_loc);
722 _M_automaton.reset();
743 std::swap(_M_flags, __rhs._M_flags);
744 std::swap(_M_loc, __rhs._M_loc);
745 std::swap(_M_automaton, __rhs._M_automaton);
748 #ifdef _GLIBCXX_DEBUG
751 { _M_automaton->_M_dot(__ostr); }
757 template<
typename _FwdIter>
758 basic_regex(_FwdIter __first, _FwdIter __last, locale_type __loc,
760 : _M_flags(__f), _M_loc(
std::
move(__loc)),
761 _M_automaton(__detail::__compile_nfa<_Rx_traits>(
765 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
766 __detail::_RegexExecutorPolicy,
bool>
769 const basic_regex<_Cp, _Rp>&,
772 template<
typename,
typename,
typename,
bool>
780 #if __cplusplus < 201703L
781 template<
typename _Ch,
typename _Tr>
785 template<
typename _Ch,
typename _Tr>
789 template<
typename _Ch,
typename _Tr>
793 template<
typename _Ch,
typename _Tr>
797 template<
typename _Ch,
typename _Tr>
801 template<
typename _Ch,
typename _Tr>
805 template<
typename _Ch,
typename _Tr>
809 template<
typename _Ch,
typename _Tr>
813 template<
typename _Ch,
typename _Tr>
817 template<
typename _Ch,
typename _Tr>
822 #if __cpp_deduction_guides >= 201606
823 template<
typename _ForwardIterator>
826 -> basic_regex<
typename iterator_traits<_ForwardIterator>::value_type>;
832 #ifdef _GLIBCXX_USE_WCHAR_T
845 template<
typename _Ch_type,
typename _Rx_traits>
849 { __lhs.swap(__rhs); }
865 template<
typename _BiIter>
871 typedef typename __iter_traits::value_type value_type;
872 typedef typename __iter_traits::difference_type difference_type;
873 typedef _BiIter iterator;
878 constexpr
sub_match() noexcept : matched() { }
895 operator string_type()
const
922 {
return this->_M_str().compare(__s._M_str()); }
936 {
return this->_M_str().compare(__s); }
940 {
return this->_M_str().compare(__s); }
946 _M_compare(
const value_type* __s,
size_t __n)
const
947 {
return this->_M_str().compare({__s, __n}); }
954 using traits_type =
typename string_type::traits_type;
956 __string_view() =
default;
958 __string_view(
const value_type* __s,
size_t __n) noexcept
959 : _M_data(__s), _M_len(__n) { }
961 __string_view(
const value_type* __s) noexcept
962 : _M_data(__s), _M_len(traits_type::length(__s)) { }
964 __string_view(
const string_type& __s) noexcept
965 : _M_data(__s.data()), _M_len(__s.length()) { }
968 compare(__string_view __s)
const noexcept
970 if (
const size_t __n =
std::min(_M_len, __s._M_len))
971 if (
int __ret = traits_type::compare(_M_data, __s._M_data, __n))
973 const difference_type __diff = _M_len - __s._M_len;
978 return static_cast<int>(__diff);
982 const value_type* _M_data =
nullptr;
987 template<
typename _Iter = _BiIter>
988 __enable_if_t<__detail::__is_contiguous_iter<_Iter>::value,
990 _M_str() const noexcept
999 template<
typename _Iter = _BiIter>
1000 __enable_if_t<!__detail::__is_contiguous_iter<_Iter>::value,
1013 #ifdef _GLIBCXX_USE_WCHAR_T
1031 template<
typename _BiIter>
1034 {
return __lhs.
compare(__rhs) == 0; }
1042 template<
typename _BiIter>
1045 {
return __lhs.
compare(__rhs) != 0; }
1053 template<
typename _BiIter>
1056 {
return __lhs.
compare(__rhs) < 0; }
1064 template<
typename _BiIter>
1067 {
return __lhs.
compare(__rhs) <= 0; }
1075 template<
typename _BiIter>
1078 {
return __lhs.
compare(__rhs) >= 0; }
1086 template<
typename _BiIter>
1089 {
return __lhs.
compare(__rhs) > 0; }
1094 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1097 _Ch_traits, _Ch_alloc>;
1107 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1109 operator==(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1111 {
return __rhs._M_compare(__lhs.data(), __lhs.size()) == 0; }
1120 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1122 operator!=(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1124 {
return !(__lhs == __rhs); }
1132 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1134 operator<(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1136 {
return __rhs._M_compare(__lhs.data(), __lhs.size()) > 0; }
1144 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1146 operator>(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1148 {
return __rhs < __lhs; }
1156 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1158 operator>=(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1160 {
return !(__lhs < __rhs); }
1168 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1170 operator<=(
const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
1172 {
return !(__rhs < __lhs); }
1181 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1184 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1185 {
return __lhs._M_compare(__rhs.data(), __rhs.size()) == 0; }
1194 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1197 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1198 {
return !(__lhs == __rhs); }
1206 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1209 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1210 {
return __lhs._M_compare(__rhs.data(), __rhs.size()) < 0; }
1218 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1221 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1222 {
return __rhs < __lhs; }
1230 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1233 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1234 {
return !(__lhs < __rhs); }
1242 template<
typename _Bi_iter,
typename _Ch_traits,
typename _Ch_alloc>
1245 const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs)
1246 {
return !(__rhs < __lhs); }
1255 template<
typename _Bi_iter>
1259 {
return __rhs.
compare(__lhs) == 0; }
1268 template<
typename _Bi_iter>
1272 {
return !(__lhs == __rhs); }
1280 template<
typename _Bi_iter>
1284 {
return __rhs.
compare(__lhs) > 0; }
1292 template<
typename _Bi_iter>
1296 {
return __rhs < __lhs; }
1304 template<
typename _Bi_iter>
1308 {
return !(__lhs < __rhs); }
1316 template<
typename _Bi_iter>
1320 {
return !(__rhs < __lhs); }
1329 template<
typename _Bi_iter>
1333 {
return __lhs.
compare(__rhs) == 0; }
1342 template<
typename _Bi_iter>
1346 {
return !(__lhs == __rhs); }
1354 template<
typename _Bi_iter>
1358 {
return __lhs.
compare(__rhs) < 0; }
1366 template<
typename _Bi_iter>
1370 {
return __rhs < __lhs; }
1378 template<
typename _Bi_iter>
1382 {
return !(__lhs < __rhs); }
1390 template<
typename _Bi_iter>
1394 {
return !(__rhs < __lhs); }
1403 template<
typename _Bi_iter>
1416 template<
typename _Bi_iter>
1420 {
return !(__lhs == __rhs); }
1429 template<
typename _Bi_iter>
1442 template<
typename _Bi_iter>
1446 {
return __rhs < __lhs; }
1455 template<
typename _Bi_iter>
1459 {
return !(__lhs < __rhs); }
1468 template<
typename _Bi_iter>
1472 {
return !(__rhs < __lhs); }
1481 template<
typename _Bi_iter>
1494 template<
typename _Bi_iter>
1498 {
return !(__lhs == __rhs); }
1507 template<
typename _Bi_iter>
1520 template<
typename _Bi_iter>
1524 {
return __rhs < __lhs; }
1533 template<
typename _Bi_iter>
1537 {
return !(__lhs < __rhs); }
1546 template<
typename _Bi_iter>
1550 {
return !(__rhs < __lhs); }
1560 template<
typename _Ch_type,
typename _Ch_traits,
typename _Bi_iter>
1565 {
return __os << __m.
str(); }
1591 template<
typename _Bi_iter,
1594 :
private std::vector<sub_match<_Bi_iter>, _Alloc>
1623 typedef const value_type& const_reference;
1624 typedef value_type& reference;
1625 typedef typename _Base_type::const_iterator const_iterator;
1627 typedef typename __iter_traits::difference_type difference_type;
1629 typedef _Alloc allocator_type;
1630 typedef typename __iter_traits::value_type char_type;
1719 _GLIBCXX_NODISCARD
bool
1721 {
return size() == 0; }
1740 {
return (*
this)[__sub].length(); }
1767 str(size_type __sub = 0)
const
1784 __glibcxx_assert(
ready() );
1785 return __sub <
size()
1787 : _M_unmatched_sub();
1801 __glibcxx_assert(
ready() );
1802 return !
empty() ? _M_prefix() : _M_unmatched_sub();
1816 __glibcxx_assert(
ready() );
1817 return !
empty() ? _M_suffix() : _M_unmatched_sub();
1832 {
return this->
begin(); }
1846 {
return this->
end(); }
1863 template<
typename _Out_iter>
1865 format(_Out_iter __out,
const char_type* __fmt_first,
1866 const char_type* __fmt_last,
1872 template<
typename _Out_iter,
typename _St,
typename _Sa>
1884 template<
typename _St,
typename _Sa>
1921 {
return _Base_type::get_allocator(); }
1938 swap(_M_begin, __that._M_begin);
1943 template<
typename,
typename,
typename>
1948 template<
typename,
typename,
typename,
bool>
1951 template<
typename _Bp,
typename _Ap,
typename _Cp,
typename _Rp,
1952 __detail::_RegexExecutorPolicy,
bool>
1961 _M_resize(
unsigned int __size)
1966 _M_establish_failed_match(_Bi_iter __end)
1968 sub_match<_Bi_iter> __sm;
1969 __sm.first = __sm.second = __end;
1974 _M_unmatched_sub()
const
1977 sub_match<_Bi_iter>&
1985 sub_match<_Bi_iter>&
1993 sub_match<_Bi_iter>&
2003 #ifdef _GLIBCXX_USE_WCHAR_T
2015 template<
typename _Bi_iter,
typename _Alloc>
2020 if (__m1.ready() != __m2.ready())
2024 if (__m1.empty() != __m2.empty())
2028 return __m1.prefix() == __m2.prefix()
2029 && __m1.size() == __m2.size()
2030 &&
std::equal(__m1.begin(), __m1.end(), __m2.begin())
2031 && __m1.suffix() == __m2.suffix();
2039 template<
typename _Bi_iter,
class _Alloc>
2043 {
return !(__m1 == __m2); }
2053 template<
typename _Bi_iter,
typename _Alloc>
2057 { __lhs.swap(__rhs); }
2059 _GLIBCXX_END_NAMESPACE_CXX11
2082 template<
typename _Bi_iter,
typename _Alloc,
2083 typename _Ch_type,
typename _Rx_traits>
2092 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2093 __detail::_RegexExecutorPolicy::_S_auto,
true>
2094 (__s, __e, __m, __re, __flags);
2111 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2119 return regex_match(__first, __last, __what, __re, __flags);
2136 template<
typename _Ch_type,
typename _Alloc,
typename _Rx_traits>
2143 {
return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
2159 template<
typename _Ch_traits,
typename _Ch_alloc,
2160 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2164 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2168 {
return regex_match(__s.
begin(), __s.
end(), __m, __re, __flags); }
2173 template<
typename _Ch_traits,
typename _Ch_alloc,
2174 typename _Alloc,
typename _Ch_type,
typename _Rx_traits>
2178 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2196 template<
typename _Ch_type,
class _Rx_traits>
2202 {
return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
2217 template<
typename _Ch_traits,
typename _Str_allocator,
2218 typename _Ch_type,
typename _Rx_traits>
2224 {
return regex_match(__s.
begin(), __s.
end(), __re, __flags); }
2240 template<
typename _Bi_iter,
typename _Alloc,
2241 typename _Ch_type,
typename _Rx_traits>
2249 return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits,
2250 __detail::_RegexExecutorPolicy::_S_auto,
false>
2251 (__s, __e, __m, __re, __flags);
2265 template<
typename _Bi_iter,
typename _Ch_type,
typename _Rx_traits>
2273 return regex_search(__first, __last, __what, __re, __flags);
2288 template<
typename _Ch_type,
class _Alloc,
class _Rx_traits>
2295 {
return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
2307 template<
typename _Ch_type,
typename _Rx_traits>
2313 {
return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
2325 template<
typename _Ch_traits,
typename _String_allocator,
2326 typename _Ch_type,
typename _Rx_traits>
2329 _String_allocator>& __s,
2333 {
return regex_search(__s.begin(), __s.end(), __e, __flags); }
2347 template<
typename _Ch_traits,
typename _Ch_alloc,
2348 typename _Alloc,
typename _Ch_type,
2349 typename _Rx_traits>
2353 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>& __m,
2357 {
return regex_search(__s.
begin(), __s.
end(), __m, __e, __f); }
2362 template<
typename _Ch_traits,
typename _Ch_alloc,
2363 typename _Alloc,
typename _Ch_type,
2364 typename _Rx_traits>
2368 _Ch_traits, _Ch_alloc>::const_iterator, _Alloc>&,
2387 template<
typename _Out_iter,
typename _Bi_iter,
2388 typename _Rx_traits,
typename _Ch_type,
2389 typename _St,
typename _Sa>
2397 return regex_replace(__out, __first, __last, __e, __fmt.
c_str(), __flags);
2413 template<
typename _Out_iter,
typename _Bi_iter,
2414 typename _Rx_traits,
typename _Ch_type>
2416 regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
2418 const _Ch_type* __fmt,
2433 template<
typename _Rx_traits,
typename _Ch_type,
2434 typename _St,
typename _Sa,
typename _Fst,
typename _Fsa>
2444 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2459 template<
typename _Rx_traits,
typename _Ch_type,
2460 typename _St,
typename _Sa>
2464 const _Ch_type* __fmt,
2470 __s.
begin(), __s.
end(), __e, __fmt, __flags);
2485 template<
typename _Rx_traits,
typename _Ch_type,
2486 typename _St,
typename _Sa>
2497 __e, __fmt, __flags);
2512 template<
typename _Rx_traits,
typename _Ch_type>
2516 const _Ch_type* __fmt,
2523 __e, __fmt, __flags);
2529 _GLIBCXX_BEGIN_NAMESPACE_CXX11
2536 template<
typename _Bi_iter,
2544 typedef std::ptrdiff_t difference_type;
2565 : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match()
2567 if (!regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags))
2597 {
return !(*
this == __rhs); }
2604 {
return _M_match; }
2611 {
return &_M_match; }
2631 _Bi_iter _M_begin {};
2633 const regex_type* _M_pregex =
nullptr;
2635 match_results<_Bi_iter> _M_match;
2640 #ifdef _GLIBCXX_USE_WCHAR_T
2653 template<
typename _Bi_iter,
2661 typedef std::ptrdiff_t difference_type;
2675 : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr),
2700 : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0)
2701 { _M_init(__a, __b); }
2717 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2718 { _M_init(__a, __b); }
2734 : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0)
2735 { _M_init(__a, __b); }
2746 template<std::
size_t _Nm>
2749 const int (&__submatches)[_Nm],
2752 : _M_position(__a, __b, __re, __m),
2753 _M_subs(__submatches, __submatches + _Nm), _M_n(0)
2754 { _M_init(__a, __b); }
2769 template <std::
size_t _Nm>
2780 : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
2781 _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
2782 { _M_normalize_result(); }
2802 {
return !(*
this == __rhs); }
2809 {
return *_M_result; }
2816 {
return _M_result; }
2839 _M_init(_Bi_iter __a, _Bi_iter __b);
2842 _M_current_match()
const
2844 if (_M_subs[_M_n] == -1)
2845 return (*_M_position).prefix();
2847 return (*_M_position)[_M_subs[_M_n]];
2851 _M_end_of_seq()
const
2852 {
return _M_result ==
nullptr; }
2856 _M_normalize_result()
2858 if (_M_position != _Position())
2859 _M_result = &_M_current_match();
2861 _M_result = &_M_suffix;
2863 _M_result =
nullptr;
2866 _Position _M_position;
2868 value_type _M_suffix;
2870 const value_type* _M_result;
2882 #ifdef _GLIBCXX_USE_WCHAR_T
2892 _GLIBCXX_END_NAMESPACE_CXX11
2893 _GLIBCXX_END_NAMESPACE_VERSION
int compare(const string_type &__s) const
Compares this sub_match to a string.
flag_type flags() const
Gets the flags used to construct the regular expression or in the last call to assign().
const value_type * operator->() const noexcept
Selects a regex_iterator member.
A smart pointer with reference-counted copy semantics.
Takes a regex and an input string and does the matching.
bool operator==(const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the equivalence of a string and a regular expression submatch.
constexpr bool equal(_IIter1 __first1, _IIter1 __last1, _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
Tests a range for element-wise equality.
bool operator==(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for equality.
basic_regex & assign(const basic_regex &__rhs)
the real assignment operator.
size_type size() const noexcept
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
constexpr match_flag_type match_default
regex_iterator & operator=(const regex_iterator &)=default
Copy assigns one regex_iterator to another.
Primary class template ctype facet.
bool regex_search(_Bi_iter __first, _Bi_iter __last, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
basic_regex(initializer_list< _Ch_type > __l, flag_type __f=ECMAScript)
Constructs a basic regular expression from an initializer list.
string_type format(const char_type *__fmt, match_flag_type __flags=regex_constants::format_default) const
bool regex_search(const _Ch_type *__s, match_results< const _Ch_type *, _Alloc > &__m, const basic_regex< _Ch_type, _Rx_traits > &__e, regex_constants::match_flag_type __f=regex_constants::match_default)
Searches for a regular expression within a C-string.
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...
bool operator!=(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
Tests the inequivalence of a regular expression submatch and a string.
const_iterator cbegin() const noexcept
Gets an iterator to the start of the sub_match collection.
match_results< string::const_iterator > smatch
Tests the equivalence of two regular expression submatches.
match_results()
Constructs a default match_results container.
basic_regex & operator=(const _Ch_type *__p)
Replaces a regular expression with a new one constructed from a C-style null-terminated string.
regex_token_iterator()
Default constructs a regex_token_iterator.
~basic_regex()
Destroys a basic regular expression.
_BiIter first
The first 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.
regex_iterator()=default
Provides a singular iterator, useful for indicating one-past-the-end of a range.
constexpr syntax_option_type egrep
bool operator!=(const regex_token_iterator &__rhs) const
Compares a regex_token_iterator to another for inequality.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
regex_token_iterator< string::const_iterator > sregex_token_iterator
Token iterator for standard strings.
typename _Size< _Alloc, difference_type >::type size_type
The allocator's size type.
basic_regex & operator=(const basic_regex &__rhs)
Assigns one regular expression to another.
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.
regex_token_iterator< const char * > cregex_token_iterator
Token iterator for C-style NULL-terminated strings.
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)
static constexpr flag_type ECMAScript
regex_iterator< const wchar_t * > wcregex_iterator
Token iterator for C-style NULL-terminated strings.
bool operator>(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
Tests the ordering of a regular expression submatch and a C string.
syntax_option_type
This is a bitmask type indicating how to interpret the regex.
static std::size_t length(const char_type *__p)
Gives the length of a C-style string starting at __p.
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.
reference operator[](size_type __n) noexcept
Subscript access to the data contained in the vector.
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...
_Out_iter format(_Out_iter __out, const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
ISO C++ entities toplevel namespace is std.
sub_match< string::const_iterator > ssub_match
Standard regex submatch over a standard string.
Forward iterators support a superset of input iterator operations.
bool regex_match(const _Ch_type *__s, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __f=regex_constants::match_default)
Indicates if there is a match between the regular expression e and a C-style null-terminated string.
const_iterator begin() const noexcept
Gets an iterator to the start of the sub_match collection.
static constexpr _Tp min() noexcept
locale_type getloc() const
Gets the locale currently imbued in the regular expression object.
string_type transform_primary(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence, independent of case.
bool regex_search(const _Ch_type *__s, const basic_regex< _Ch_type, _Rx_traits > &__e, regex_constants::match_flag_type __f=regex_constants::match_default)
Searches for a regular expression within a C-string.
void assign(size_type __n, const value_type &__val)
Assigns a given value to a vector.
const value_type & operator*() const noexcept
Dereferences a regex_iterator.
const_reference prefix() const
Gets a sub_match representing the match prefix.
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_string< char_type, _St, _Sa > format(const basic_string< char_type, _St, _Sa > &__fmt, match_flag_type __flags=regex_constants::format_default) const
bool empty() const noexcept
Indicates if the match_results contains no results.
char_type translate(char_type __c) const
Performs the identity translation.
bool operator!=(const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__rhs)
Tests the inequivalence of a regular expression submatch and a string.
bool operator!=(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2) noexcept
Compares two match_results for inequality.
bool operator>=(typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a C string and a regular expression submatch.
A standard container which offers fixed time access to individual elements in any order.
iterator begin() noexcept
const _CharT * data() const noexcept
Return const pointer to contents.
sub_match< const char * > csub_match
Standard regex submatch over a C-style null-terminated string.
basic_string< _Ch_type, _St, _Sa > regex_replace(const basic_string< _Ch_type, _St, _Sa > &__s, const basic_regex< _Ch_type, _Rx_traits > &__e, const basic_string< _Ch_type, _Fst, _Fsa > &__fmt, regex_constants::match_flag_type __flags=regex_constants::match_default)
Search for a regular expression within a string for multiple times, and replace the matched parts thr...
constexpr syntax_option_type extended
static constexpr flag_type icase
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...
int compare(const value_type *__s) const
Compares this sub_match to a string.
bool operator>=(typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a character and a regular expression submatch.
regex_token_iterator & operator=(const regex_token_iterator &__rhs)
Assigns a regex_token_iterator to another.
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...
size_type max_size() const noexcept
bool operator==(typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the equivalence of a character and a regular expression submatch.
Describes aspects of a regular expression.
allocator_type get_allocator() const noexcept
Gets a copy of the allocator.
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 sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
Tests the equivalence of two regular expression submatches.
string_type str(size_type __sub=0) const
Gets the match or submatch converted to a string type.
bool regex_search(const basic_string< _Ch_type, _Ch_traits, _String_allocator > &__s, const basic_regex< _Ch_type, _Rx_traits > &__e, regex_constants::match_flag_type __flags=regex_constants::match_default)
Searches for a regular expression within a string.
locale_type imbue(locale_type __loc)
Imbues the regex_traits object with a copy of a new locale.
const value_type & operator*() const
Dereferences a regex_token_iterator.
regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)
bool operator>=(const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__rhs)
Tests the ordering of a regular expression submatch and a string.
back_insert_iterator< _Container > back_inserter(_Container &__x)
static constexpr flag_type egrep
bool operator==(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
Tests the equivalence of a regular expression submatch and a character.
int value(_Ch_type __ch, int __radix) const
Converts a digit to an int.
constexpr syntax_option_type basic
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
void swap(match_results &__that) noexcept
Swaps the contents of two match_results.
The results of a match or search operation.
void swap(match_results< _Bi_iter, _Alloc > &__lhs, match_results< _Bi_iter, _Alloc > &__rhs) noexcept
Swaps two match results.
bool operator!=(typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the inequivalence of a C string and a regular expression submatch.
bool operator>=(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
Tests the ordering of a regular expression submatch and a character.
bool operator!=(const regex_iterator &__rhs) const noexcept
Tests the inequivalence of two regex iterators.
_Tp * end(valarray< _Tp > &__va)
Return an iterator pointing to one past the last element of the valarray.
basic_regex & operator=(basic_regex &&__rhs) noexcept
Move-assigns one regular expression to another.
regex_iterator< wstring::const_iterator > wsregex_iterator
Token iterator for C-style NULL-terminated strings.
bool regex_match(const basic_string< _Ch_type, _Ch_traits, _Str_allocator > &__s, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
Indicates if there is a match between the regular expression e and a string.
size_type size() const noexcept
Gets the number of matches and submatches.
constexpr syntax_option_type ECMAScript
basic_regex & assign(basic_regex &&__rhs) noexcept
The move-assignment operator.
_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...
Container class for localization functionality.
string_type transform(_Fwd_iter __first, _Fwd_iter __last) const
Gets a sort key for a character sequence.
const_iterator cend() const noexcept
Gets an iterator to one-past-the-end of the collection.
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 regex_match(const _Ch_type *__s, match_results< const _Ch_type *, _Alloc > &__m, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __f=regex_constants::match_default)
Determines if there is a match between the regular expression e and a C-style null-terminated string.
regex_iterator< const char * > cregex_iterator
Token iterator for C-style NULL-terminated strings.
bool isctype(_Ch_type __c, char_class_type __f) const
Determines if c is a member of an identified class.
bool regex_match(_Bi_iter __first, _Bi_iter __last, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
Indicates if there is a match between the regular expression e and all of the character sequence [fir...
sub_match< const wchar_t * > wcsub_match
Regex submatch over a C-style null-terminated wide string.
constexpr syntax_option_type awk
match_results(const _Alloc &__a) noexcept
Constructs a default match_results container.
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)
locale_type imbue(locale_type __loc)
Imbues the regular expression object with the given locale.
string_type str() const
Gets the matching sequence as a string.
bool operator!=(const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the inequivalence of a string and a regular expression submatch.
void swap(basic_regex< _Ch_type, _Rx_traits > &__lhs, basic_regex< _Ch_type, _Rx_traits > &__rhs)
Swaps the contents of two regular expression objects.
bool operator>=(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
Tests the ordering of a regular expression submatch and a C string.
regex_iterator operator++(int)
Postincrements a regex_iterator.
static constexpr flag_type grep
basic_regex & assign(initializer_list< _Ch_type > __l, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
static constexpr _Tp max() noexcept
regex_iterator & operator++()
Increments a regex_iterator.
difference_type position(size_type __sub=0) const
Gets the offset of the beginning of the indicated submatch.
_Tp * begin(valarray< _Tp > &__va)
Return an iterator pointing to the first element of the valarray.
basic_regex< char > regex
Standard regular expressions.
regex_token_iterator< const wchar_t * > wcregex_token_iterator
Token iterator for C-style NULL-terminated wide strings.
regex_token_iterator operator++(int)
Postincrements a regex_token_iterator.
constexpr _Iterator __base(_Iterator __it)
bool operator>=(const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
Tests the ordering of two regular expression submatches.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
regex_traits()
Constructs a default traits object.
regex_token_iterator & operator++()
Increments a regex_token_iterator.
basic_string< _Ch_type, _St, _Sa > regex_replace(const basic_string< _Ch_type, _St, _Sa > &__s, const basic_regex< _Ch_type, _Rx_traits > &__e, const _Ch_type *__fmt, regex_constants::match_flag_type __flags=regex_constants::match_default)
Search for a regular expression within a string for multiple times, and replace the matched parts thr...
bool operator!=(const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
Tests the inequivalence of two regular expression submatches.
static constexpr flag_type nosubs
constexpr syntax_option_type optimize
bitset< _Nb > operator&(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
constexpr syntax_option_type icase
bool operator==(const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__rhs)
Tests the equivalence of a regular expression submatch and a string.
unsigned int mark_count() const
Gets the number of marked subexpressions within the regular expression.
void swap(vector &__x) noexcept
Swaps data with another vector.
bool operator!=(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
Tests the inequivalence of a regular expression submatch and a character.
static constexpr flag_type basic
bool operator==(typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the equivalence of a C string and a regular expression submatch.
difference_type length(size_type __sub=0) const
Gets the length of the indicated submatch.
void swap(basic_regex &__rhs)
Swaps the contents of two regular expression objects.
bool operator>(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const &__rhs)
Tests the ordering of a regular expression submatch and a character.
char_type translate_nocase(char_type __c) const
Translates a character into a case-insensitive equivalent.
const_reference suffix() const
Gets a sub_match representing the match suffix.
Facet for localized string comparison.
static constexpr flag_type awk
match_results< const char * > cmatch
Tests the equivalence of two regular expression submatches.
bool operator>(const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
Tests the ordering of two regular expression submatches.
Managing sequences of characters and character-like objects.
friend bool __detail::__regex_algo_impl(_Bp, _Bp, match_results< _Bp, _Ap > &, const basic_regex< _Cp, _Rp > &, regex_constants::match_flag_type)
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...
The standard allocator, as per [20.4].
bool operator!=(typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the inequivalence of a character and a regular expression submatch.
bool ready() const noexcept
Indicates if the match_results is ready.
basic_string< _Ch_type > regex_replace(const _Ch_type *__s, const basic_regex< _Ch_type, _Rx_traits > &__e, const _Ch_type *__fmt, regex_constants::match_flag_type __flags=regex_constants::match_default)
Search for a regular expression within a C-string for multiple times, and replace the matched parts t...
_BiIter second
The second member.
Properties of fundamental types.
constexpr syntax_option_type grep
constexpr match_flag_type format_default
basic_regex & assign(_InputIterator __first, _InputIterator __last, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object.
regex_iterator< string::const_iterator > sregex_iterator
Token iterator for C-style NULL-terminated strings.
int compare(const sub_match &__s) const
Compares this and another matched sequence.
basic_regex & assign(const _Ch_type *__p, size_t __len, flag_type __flags=ECMAScript)
Assigns a new regular expression to a regex object from a C-style string containing a regular express...
difference_type length() const noexcept
Gets the length of the matching sequence.
const_iterator end() const noexcept
Gets an iterator to one-past-the-end of the collection.
basic_string< _Ch_type > regex_replace(const _Ch_type *__s, 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 C-string for multiple times, and replace the matched parts t...
bool regex_match(const basic_string< _Ch_type, _Ch_traits, _Ch_alloc > &__s, match_results< typename basic_string< _Ch_type, _Ch_traits, _Ch_alloc >::const_iterator, _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 a string.
bool operator==(const sub_match< _Bi_iter > &__lhs, typename iterator_traits< _Bi_iter >::value_type const *__rhs)
Tests the equivalence of a regular expression submatch and a C string.
bool operator>(typename iterator_traits< _Bi_iter >::value_type const *__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a C string and a regular expression submatch.
regex_token_iterator< wstring::const_iterator > wsregex_token_iterator
Token iterator for standard wide-character strings.
regex_token_iterator(const regex_token_iterator &__rhs)
Copy constructs a regex_token_iterator.
bool empty() const noexcept
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)
const value_type * operator->() const
Selects a regex_token_iterator member.
bool operator==(const match_results< _Bi_iter, _Alloc > &__m1, const match_results< _Bi_iter, _Alloc > &__m2) noexcept
Compares two match_results for equality.
const_reference operator[](size_type __sub) const
Gets a sub_match reference for the match or submatch.
static constexpr flag_type optimize
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
Traits class for iterators.
constexpr syntax_option_type collate
static constexpr flag_type extended
_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
match_results< const wchar_t * > wcmatch
Tests the equivalence of two regular expression submatches.
Struct holding two objects of arbitrary type.
match_flag_type
This is a bitmask type indicating regex matching rules.
basic_regex< wchar_t > wregex
Standard wide-character regular expressions.
bool operator==(const regex_iterator &) const noexcept
Tests the equivalence of two regex iterators.
string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
Gets a collation element by name.
match_results< wstring::const_iterator > wsmatch
Tests the equivalence of two regular expression submatches.
constexpr syntax_option_type nosubs
bool operator>(const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a string and a regular expression submatch.
regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type &__re, int __submatch=0, regex_constants::match_flag_type __m=regex_constants::match_default)
size_type max_size() const noexcept
Gets the number of matches and submatches.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
bool operator>(const sub_match< _Bi_iter > &__lhs, const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__rhs)
Tests the ordering of a regular expression submatch and a string.
bool operator>=(const __sub_match_string< _Bi_iter, _Ch_traits, _Ch_alloc > &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a string and a regular expression submatch.
sub_match< wstring::const_iterator > wssub_match
Regex submatch over a standard wide string.
Basis for explicit traits specializations.
bool regex_search(const basic_string< _Ch_type, _Ch_traits, _Ch_alloc > &__s, match_results< typename basic_string< _Ch_type, _Ch_traits, _Ch_alloc >::const_iterator, _Alloc > &__m, const basic_regex< _Ch_type, _Rx_traits > &__e, regex_constants::match_flag_type __f=regex_constants::match_default)
Searches for a regular expression within a string.
bool operator>(typename iterator_traits< _Bi_iter >::value_type const &__lhs, const sub_match< _Bi_iter > &__rhs)
Tests the ordering of a character and a regular expression submatch.