Ejemplo n.º 1
0
  std::basic_string<C>
  perl_s (std::basic_string<C> const& src, std::basic_string<C> const& e)
  {
    typedef std::basic_string<C> string;
    typedef typename string::size_type size;

    if (e.empty ())
      return src;

    C delimiter (e[0]);

    size first = e.find (delimiter);
    size middle = e.find (delimiter, first + 1);
    size last = e.find (delimiter, middle + 1);

    string pattern (e, first + 1, middle - first - 1);
    string format (e, middle + 1, last - middle - 1);

    //std::cout << pattern << "  " << format << std::endl;

    boost::basic_regex<C> expr (pattern);

    return regex_merge (
      src,
      expr,
      format,
      boost::match_default | boost::format_all );
  }
Ejemplo n.º 2
0
inline OutputIterator regex_merge(OutputIterator out,
                         Iterator first,
                         Iterator last,
                         const basic_regex<charT, traits>& e, 
                         const std::basic_string<charT>& fmt,
                         match_flag_type flags = match_default)
{
   return regex_merge(out, first, last, e, fmt.c_str(), flags);
}