# deduction guides for std::basic_regex

> C++ Atlas: `cppatlas.com/w/cpp/regex/basic_regex/deduction_guides` | Source: https://en.cppreference.com/w/cpp/regex/basic_regex/deduction_guides | Domain: Regular expressions | Standards: C++17

This deduction guide is provided for std::basic_regex to allow deduction from an iterator range.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <regex>

template< class ForwardIt >
basic_regex( ForwardIt, ForwardIt,
             std::regex_constants::syntax_option_type = std::regex_constants::ECMAScript )
-> basic_regex<typename std::iterator_traits<ForwardIt>::value_type>; // (since C++17)
```

This deduction guide is provided for `std::basic_regex` to allow deduction from an iterator range.

### Example

```cpp
#include <regex>
#include <vector>

int main()
{
    std::vector<char> v = {'a', 'b', 'c'};
    std::basic_regex re(v.begin(), v.end()); // uses explicit deduction guide
}
```

---
Attribution: content from https://en.cppreference.com/w/cpp/regex/basic_regex/deduction_guides (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.