# std::basic_regex<CharT,Traits>::swap

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

Exchanges the contents of two regular expressions.

## Official Specification Summary (cppreference)

```cpp
void swap( basic_regex& other ) noexcept; // (since C++11)
```

Exchanges the contents of two regular expressions.

### Parameters

- `other` - the regular expression to swap with

### Return value

(none)

### Example

> Note: This section is incomplete Reason: no example

### See also

- [`std::swap(std::basic_regex)`](https://en.cppreference.com/w/cpp/regex/basic_regex/swap2) (C++11): specializes the `std::swap` algorithm (function template)

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