📄 regex.hpp
字号:
a modified copy of the input \note The second variant of this function provides the strong exception-safety guarantee */ template< typename OutputIteratorT, typename CollectionT, typename CharT, typename RegexTraitsT, typename RegexAllocatorT > inline OutputIteratorT erase_regex_copy( OutputIteratorT Output, const CollectionT& Input, const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx, match_flag_type Flags=match_default ) { return find_format_copy( Output, Input, regex_finder( Rx, Flags ), empty_formatter( Input ) ); } //! Erase regex algorithm /*! \overload */ template< typename SequenceT, typename CharT, typename RegexTraitsT, typename RegexAllocatorT > inline SequenceT erase_regex_copy( const SequenceT& Input, const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx, match_flag_type Flags=match_default ) { return find_format_copy( Input, regex_finder( Rx, Flags ), empty_formatter( Input ) ); } //! Erase regex algorithm /*! Remove a substring matching given regex from the input. The input string is modified in-place. \param Input An input string \param Rx A regular expression \param Flags Regex options */ template< typename SequenceT, typename CharT, typename RegexTraitsT, typename RegexAllocatorT > inline void erase_regex( SequenceT& Input, const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx, match_flag_type Flags=match_default ) { find_format( Input, regex_finder( Rx, Flags ), empty_formatter( Input ) ); }// erase_all_regex --------------------------------------------------------------------// //! Erase all regex algorithm /*! Erase all substrings, matching given regex, from the input. The result is a modified copy of the input. It is returned as a sequence or copied to the output iterator. \param Output An output iterator to which the result will be copied \param Input An input string \param Rx A regular expression \param Flags Regex options \return An output iterator pointing just after the last inserted character or a modified copy of the input \note The second variant of this function provides the strong exception-safety guarantee */ template< typename OutputIteratorT, typename CollectionT, typename CharT, typename RegexTraitsT, typename RegexAllocatorT > inline OutputIteratorT erase_all_regex_copy( OutputIteratorT Output, const CollectionT& Input, const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx, match_flag_type Flags=match_default ) { return find_format_all_copy( Output, Input, regex_finder( Rx, Flags ), empty_formatter( Input ) ); } //! Erase all regex algorithm /*! \overload */ template< typename SequenceT, typename CharT, typename RegexTraitsT, typename RegexAllocatorT > inline SequenceT erase_all_regex_copy( const SequenceT& Input, const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx, match_flag_type Flags=match_default ) { return find_format_all_copy( Input, regex_finder( Rx, Flags ), empty_formatter( Input ) ); } //! Erase all regex algorithm /*! Erase all substrings, matching given regex, from the input. The input string is modified in-place. \param Input An input string \param Rx A regular expression \param Flags Regex options */ template< typename SequenceT, typename CharT, typename RegexTraitsT, typename RegexAllocatorT> inline void erase_all_regex( SequenceT& Input, const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx, match_flag_type Flags=match_default ) { find_format_all( Input, regex_finder( Rx, Flags ), empty_formatter( Input ) ); }// find_all_regex ------------------------------------------------------------------// //! Find all regex algorithm /*! This algorithm finds all substrings matching the give regex in the input. Each part is copied and added as a new element to the output container. Thus the result container must be able to hold copies of the matches (in a compatible structure like std::string) or a reference to it (e.g. using the iterator range class). Examples of such a container are \c std::vector<std::string> or \c std::list<boost::iterator_range<std::string::iterator>> \param Result A container that can hold copies of references to the substrings. \param Input A container which will be searched. \param Rx A regular expression \param Flags Regex options \return A reference to the result \note Prior content of the result will be overwritten. \note This function provides the strong exception-safety guarantee */ template< typename SequenceSequenceT, typename CollectionT, typename CharT, typename RegexTraitsT, typename RegexAllocatorT > inline SequenceSequenceT& find_all_regex( SequenceSequenceT& Result, const CollectionT& Input, const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx, match_flag_type Flags=match_default ) { return iter_find( Result, Input, regex_finder(Rx,Flags) ); }// split_regex ------------------------------------------------------------------// //! Split regex algorithm /*! Tokenize expression. This function is equivalent to C strtok. Input sequence is split into tokens, separated by separators. Separator is an every match of the given regex. Each part is copied and added as a new element to the output container. Thus the result container must be able to hold copies of the matches (in a compatible structure like std::string) or a reference to it (e.g. using the iterator range class). Examples of such a container are \c std::vector<std::string> or \c std::list<boost::iterator_range<std::string::iterator>> \param Result A container that can hold copies of references to the substrings. \param Input A container which will be searched. \param Rx A regular expression \param Flags Regex options \return A reference to the result \note Prior content of the result will be overwritten. \note This function provides the strong exception-safety guarantee */ template< typename SequenceSequenceT, typename CollectionT, typename CharT, typename RegexTraitsT, typename RegexAllocatorT > inline SequenceSequenceT& split_regex( SequenceSequenceT& Result, const CollectionT& Input, const reg_expression<CharT, RegexTraitsT, RegexAllocatorT>& Rx, match_flag_type Flags=match_default ) { return iter_split( Result, Input, regex_finder(Rx,Flags) ); } } // namespace algorithm // pull names into the boost namespace using algorithm::find_regex; using algorithm::replace_regex; using algorithm::replace_regex_copy; using algorithm::replace_all_regex; using algorithm::replace_all_regex_copy; using algorithm::erase_regex; using algorithm::erase_regex_copy; using algorithm::erase_all_regex; using algorithm::erase_all_regex_copy; using algorithm::find_all_regex; using algorithm::split_regex;} // namespace boost#endif // BOOST_STRING_REGEX_HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -