regex_format.qbk 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. [/
  2. Copyright 2006-2007 John Maddock.
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. ]
  7. [section:regex_format regex_format (Deprecated)]
  8. The algorithm `regex_format` is deprecated; new code should use
  9. [match_results_format] instead. Existing code will continue to compile,
  10. the following documentation is taken from the previous version of Boost.Regex and
  11. will not be further updated:
  12. [h4 Algorithm regex_format]
  13. #include <boost/regex.hpp>
  14. The algorithm `regex_format` takes the results of a match and creates a
  15. new string based upon a format string, `regex_format` can be used for
  16. search and replace operations:
  17. template <class OutputIterator, class iterator, class Allocator, class Formatter>
  18. OutputIterator regex_format(OutputIterator out,
  19. const match_results<iterator, Allocator>& m,
  20. Formatter fmt,
  21. match_flag_type flags = 0);
  22. The library also defines the following convenience variation of
  23. `regex_format`, which returns the result directly as a string, rather
  24. than outputting to an iterator.
  25. [note This version may not be available, or may be available in a more limited
  26. form, depending upon your compilers capabilities]
  27. template <class iterator, class Allocator, class Formatter>
  28. std::basic_string<charT> regex_format
  29. (const match_results<iterator, Allocator>& m,
  30. Formatter fmt,
  31. match_flag_type flags = 0);
  32. Parameters to the main version of the function are passed as follows:
  33. [table
  34. [[Parameter][Description]]
  35. [[`OutputIterator out`][An output iterator type, the output string is sent to this iterator. Typically this would be a std::ostream_iterator. ]]
  36. [[`const match_results<iterator, Allocator>& m`][An instance of [match_results] obtained from one of the matching algorithms above, and denoting what matched. ]]
  37. [[`Formatter fmt`][Either a format string that determines how the match is transformed into the new string, or a functor that computes the new string from /m/ - see [match_results_format]. ]]
  38. [[`unsigned flags`][Optional flags which describe how the format string is to be interpreted. ]]
  39. ]
  40. Format flags are described under [match_flag_type].
  41. The format string syntax (and available options) is described more fully
  42. under [link boost_regex.format format strings].
  43. [endsect]