---
name: "std::regex_error"
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_error"
---

# std::regex\_error(3)

A regular expression exception class.

## NAME

std::regex\_error - A regular expression exception class.

## SYNOPSIS

\#include \<regex\>

Inherits **std::runtime\_error**.

### Public Member Functions

**regex\_error** (**error\_type** \_\_ecode)\
 Constructs a regex\_error object.  **regex\_constants::error\_type** **code** () const noexcept\
 Gets the regex error code.  virtual const char \* **what** () const noexcept\

## Detailed Description

A regular expression exception class.

The regular expression library throws objects of this class on error.

**Since**

C++11

## Constructor & Destructor Documentation

### std::regex\_error::regex\_error (error\_type \_\_ecode) \[explicit\]

Constructs a regex\_error object.

**Parameters**

*\_\_ecode* the regex error code.

References **regex\_error()**.

Referenced by **regex\_error()**.

## Member Function Documentation

### regex\_constants::error\_type std::regex\_error::code () const \[inline\], \[noexcept\]

Gets the regex error code.

**Returns**

the regex error code.

References **code()**.

Referenced by **code()**.

### virtual const char \* std::runtime\_error::what () const \[virtual\], \[noexcept\], \[inherited\]

Returns a C-style character string describing the general cause of the current error (the same string passed to the ctor).

Reimplemented from **std::exception**.

Reimplemented in **std::experimental::filesystem::v1::filesystem\_error**, **std::filesystem::filesystem\_error**, and **std::ios\_base::failure**.

References **what()**.

Referenced by **what()**.

## Author

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