STD::REGEX_ITERATOR(3)

✨ NAME ✨

std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > β€” bestie, this is the iterator adaptor that keeps hitting regex_search over and over on a range until there's literally nothing left to match πŸ’–

(This page lives in the std::regex...Rx_traits >(3) corner of the libstdc++ manual, iykyk.)


🌸 SYNOPSIS 🌸

#include <regex>

πŸŽ€ Public Types

  • typedef std::ptrdiff_t difference_type
  • typedef std::forward_iterator_tag iterator_category
  • typedef std::input_iterator_tag iterator_concept
  • typedef const value_type * pointer
  • typedef const value_type & reference
  • typedef basic_regex< _Ch_type, _Rx_traits > regex_type
  • typedef match_results< _Bi_iter > value_type

πŸ’… Public Member Functions

  • regex_iterator ()=default β€” hands you a singular iterator, which is exactly what you want for flagging one-past-the-end of a range ✨
  • regex_iterator (_Bi_iter __a, _Bi_iter __b, const regex_type &__re, regex_constants::match_flag_type __m=regex_constants::match_default)
  • regex_iterator (_Bi_iter, _Bi_iter, const regex_type &&, regex_constants::match_flag_type=regex_constants::match_default)=delete
  • regex_iterator (const regex_iterator &)=default β€” copy constructs a regex_iterator, no cap 🫢
  • const value_type & operator* () const noexcept β€” dereferences a regex_iterator
  • regex_iterator & operator++ () β€” increments a regex_iterator
  • regex_iterator operator++ (int) β€” postincrements a regex_iterator
  • const value_type * operator-> () const noexcept β€” selects a regex_iterator member
  • regex_iterator & operator= (const regex_iterator &)=default β€” copy assigns one regex_iterator to another
  • bool operator== (const regex_iterator &) const noexcept β€” tests whether two regex iterators are equivalent
  • bool operator== (default_sentinel_t) const noexcept

πŸ¦‹ Detailed Description πŸ¦‹

template<typename _Bi_iter, typename _Ch_type = typename
    iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
    regex_traits<_Ch_type>>
class std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >"An iterator
    adaptor that will provide repeated calls of regex_search over a range
    until no more matches remain.

It's giving iterator adaptor, and its whole personality is calling regex_search on your range again and again and again until there are genuinely zero matches left. Obsessed. 😭

Since β€” C++11 ⭐


🧚 Constructor & Destructor Documentation 🧚

template<typename _Bi_iter, typename _Ch_type = typename
    iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
    regex_traits<_Ch_type>> std::regex_iterator< _Bi_iter, _Ch_type,
    _Rx_traits >::regex_iterator () [default]

Provides a singular iterator, useful for indicating one-past-the-end of a range. πŸ’«

Referenced by std::regex_iterator< const char * >::regex_iterator(), and operator==().

template<typename _Bi_iter, typename _Ch_type = typename
    iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
    regex_traits<_Ch_type>> std::regex_iterator< _Bi_iter, _Ch_type,
    _Rx_traits >::regex_iterator (_Bi_iter __a, _Bi_iter __b, const
    regex_type & __re, regex_constants::match_flag_type __m =
    regex_constants::match_default) [inline]

Constructs a regex_iterator... ✨

Parameters

  • __a [IN] β€” where your text range starts, bestie
  • __b [IN] β€” one-past-the-end of the text range you're searching
  • __re [IN] β€” the regular expression to match
  • __m [IN] β€” policy flags for match rules

template<typename _Bi_iter, typename _Ch_type = typename
    iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
    regex_traits<_Ch_type>> std::regex_iterator< _Bi_iter, _Ch_type,
    _Rx_traits >::regex_iterator (const regex_iterator< _Bi_iter, _Ch_type,
    _Rx_traits > & ) [default]

Copy constructs a regex_iterator. Simple as that, slay. πŸ’–


πŸ‘‘ Member Function Documentation πŸ‘‘

template<typename _Bi_iter, typename _Ch_type = typename
    iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
    regex_traits<_Ch_type>> const value_type & std::regex_iterator<
    _Bi_iter, _Ch_type, _Rx_traits >::operator* () const [inline],
    [noexcept]

Dereferences a regex_iterator. 🌈


template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
    regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > & std::regex_iterator<
    _Bi_iter, _Ch_type, _Rx_traits >::operator++ ()

Increments a regex_iterator. The way this one just keeps going until it can't β€” main character energy fr fr. πŸ”₯

References std::regex_constants::match_continuous, std::regex_constants::match_not_null, std::regex_constants::match_prev_avail, and std::regex_search().

template<typename _Bi_iter, typename _Ch_type = typename
    iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
    regex_traits<_Ch_type>> regex_iterator std::regex_iterator< _Bi_iter,
    _Ch_type, _Rx_traits >::operator++ (int ) [inline]

Postincrements a regex_iterator. πŸŽ€


template<typename _Bi_iter, typename _Ch_type = typename
    iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
    regex_traits<_Ch_type>> const value_type * std::regex_iterator<
    _Bi_iter, _Ch_type, _Rx_traits >::operator-> () const [inline],
    [noexcept]

Selects a regex_iterator member. πŸ’œ


template<typename _Bi_iter, typename _Ch_type = typename
    iterator_traits<_Bi_iter>::value_type, typename _Rx_traits =
    regex_traits<_Ch_type>> regex_iterator & std::regex_iterator< _Bi_iter,
    _Ch_type, _Rx_traits >::operator= (const regex_iterator< _Bi_iter,
    _Ch_type, _Rx_traits > & ) [default]

Copy assigns one regex_iterator to another. πŸ“


template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits> bool
    std::regex_iterator< _Bi_iter, _Ch_type, _Rx_traits >::operator== (const
    regex_iterator< _Bi_iter, _Ch_type, _Rx_traits > & __rhs) const
    [noexcept]

Tests the equivalence of two regex iterators. πŸ’…

References regex_iterator().

⭐ Author ⭐

Generated automatically by Doxygen for libstdc++ from the source code.


okay that's the whole page bestie, you ate πŸ’– this one's libstdc++, std::regex...Rx_traits >(3), and yeah it was auto-generated by Doxygen β€” no cap, go read it and slay πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms