| Home | Libraries | People | FAQ | More

## Function replace_regex_copy

boost::algorithm::replace_regex_copy — Replace regex algorithm.

## Synopsis

    // In header: <boost/algorithm/string/regex.hpp>

    template<typename OutputIteratorT, typename RangeT, typename CharT,
             typename RegexTraitsT, typename FormatStringTraitsT,
             typename FormatStringAllocatorT>
      OutputIteratorT
      replace_regex_copy(OutputIteratorT Output, const RangeT & Input,
                         const basic_regex< CharT, RegexTraitsT > & Rx,
                         const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > & Format,
                         match_flag_type Flags = match_default|format_default);
    template<typename SequenceT, typename CharT, typename RegexTraitsT,
             typename FormatStringTraitsT, typename FormatStringAllocatorT>
      SequenceT replace_regex_copy(const SequenceT & Input,
                                   const basic_regex< CharT, RegexTraitsT > & Rx,
                                   const std::basic_string< CharT, FormatStringTraitsT, FormatStringAllocatorT > & Format,
                                   match_flag_type Flags = match_default|format_default);

## Description

Search for a substring matching given regex and format it with the specified format.

The result is a modified copy of the input. It is returned as a sequence or copied to the output iterator.

| Note
The second variant of this function provides the strong exception-safety guarantee

Parameters: |
`Flags` | Regex options
`Format` | Regex format definition
`Input` | An input string
`Output` | An output iterator to which the result will be copied
`Rx` | A regular expression
Returns: | An output iterator pointing just after the last inserted character or a modified copy of the input