---
name: "std::regex_error"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::regex_error/3cxx"
---

# std::regex\_error(3cxx)

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.

## Member Function Documentation

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

Gets the regex error code.

**Returns**

the regex error 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::filesystem::filesystem\_error**, and **std::experimental::filesystem::v1::filesystem\_error**.

## Author

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