---
name: "std::regex_iterator"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::regex_iterator"
---

# std::regex\_iterator(3)

## NAME

std::regex\_iterator\< \_Bi\_iter, \_Ch\_type, \_Rx\_traits \>

## 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\
 Provides a singular iterator, useful for indicating 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.  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 the equivalence of two regex iterators.  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.

**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\] The start of a text range to search. \
 *\_\_b* \[IN\] One-past-the-end of the text range to search. \
 *\_\_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.

## 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.

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.
