Boost C++ 库

...世界上最受推崇和设计精良的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu,《C++ 编码规范

函数 replace_regex_copy - Boost C++ 函数库
PrevUpHomeNext

函数 replace_regex_copy

boost::algorithm::replace_regex_copy — 正则表达式替换算法。

提要

// 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);

描述

搜索与给定正则表达式匹配的子字符串,并使用指定的格式对其进行格式化。
结果是输入的修改副本。它作为序列返回或复制到输出迭代器。

[Note] 注意

此函数的第二个变体提供强异常安全保证。

参数

输出:

一个输出迭代器,结果将被复制到该迭代器。

输入

一个输入字符串

Rx

正则表达式

Format

正则表达式格式定义

标志

正则表达式选项

返回

一个输出迭代器,指向最后一个插入字符之后的位置,或输入的修改副本。


PrevUpHomeNext