* The class %regex is parameterized around a set of related types and
* functions used to complete the definition of its semantics. This class
* satisfies the requirements of such a traits class.
+ *
+ * @headerfile regex
+ * @since C++11
*/
template<typename _Ch_type>
class regex_traits
// [7.8] Class basic_regex
/**
- * Objects of specializations of this class represent regular expressions
- * constructed from sequences of character type @p _Ch_type.
+ * @brief A regular expression
+ *
+ * Specializations of this class template represent regular expressions
+ * constructed from sequences of character type `_Ch_type`.
+ * Use the `std::regex` typedef for `std::basic_regex<char>`.
+ *
+ * A character sequence passed to the constructor will be parsed according
+ * to the chosen grammar, and used to create a state machine representing
+ * the regular expression. The regex object can then be passed to algorithms
+ * such as `std::regex_match` to match sequences of characters.
+ *
+ * The `syntax_option_type` flag passed to the constructor selects from
+ * one of the supported regular expression grammars. The default is
+ * `ECMAScript` and the others are `basic`, `extended`, `awk`, `grep`, and
+ * `egrep`, which are variations on POSIX regular expressions.
*
- * Storage for the regular expression is allocated and deallocated as
- * necessary by the member functions of this class.
+ * @headerfile regex
+ * @since C++11
*/
template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type>>
class basic_regex
* An object of this class is essentially a pair of iterators marking a
* matched subexpression within a regular expression pattern match. Such
* objects can be converted to and compared with std::basic_string objects
- * of a similar base character type as the pattern matched by the regular
+ * of the same character type as the pattern matched by the regular
* expression.
*
+ * A `sub_match<Iter>` has a public base class of type `pair<Iter, Iter>`,
+ * so inherits pair's data members named `first` and `second`.
* The iterators that make up the pair are the usual half-open interval
* referencing the actual original pattern matched.
+ *
+ * @headerfile regex
+ * @since C++11
*/
template<typename _BiIter>
- class sub_match : public std::pair<_BiIter, _BiIter>
+ class sub_match
+ /// @cond undocumented
+ : public std::pair<_BiIter, _BiIter>
+ /// @endcond
{
typedef iterator_traits<_BiIter> __iter_traits;
typedef _BiIter iterator;
typedef basic_string<value_type> string_type;
+ _GLIBCXX_DOXYGEN_ONLY(iterator first; iterator second;)
+
bool matched;
constexpr sub_match() noexcept : matched() { }
* of characters [first, second) which formed that match. Otherwise matched
* is false, and members first and second point to the end of the sequence
* that was searched.
+ *
+ * @headerfile regex
+ * @since C++11
*/
template<typename _Bi_iter,
typename _Alloc = allocator<sub_match<_Bi_iter> > >
* @brief Compares two match_results for equality.
* @returns true if the two objects refer to the same match,
* false otherwise.
+ *
+ * @relates match_results
*/
template<typename _Bi_iter, typename _Alloc>
inline bool
* @brief Compares two match_results for inequality.
* @returns true if the two objects do not refer to the same match,
* false otherwise.
+ *
+ * @relates match_results
*/
template<typename _Bi_iter, class _Alloc>
inline bool
* @param __rhs A match result.
*
* The contents of the two match_results objects are swapped.
+ *
+ * @relates match_results
*/
template<typename _Bi_iter, typename _Alloc>
inline void
// [28.11.2] Function template regex_match
/**
* @name Matching, Searching, and Replacing
+ *
+ * @{
*/
- ///@{
/**
* @brief Determines if there is a match between the regular expression @p e
// std [28.11.4] Function template regex_replace
+ /// @cond undocumented
template<typename _Out_iter, typename _Bi_iter,
typename _Rx_traits, typename _Ch_type>
_Out_iter
const basic_regex<_Ch_type, _Rx_traits>& __e,
const _Ch_type* __fmt, size_t __len,
regex_constants::match_flag_type __flags);
+ /// @endcond
/**
* @brief Search for a regular expression within a range for multiple times,
return __result;
}
- ///@}
+ /// @}
_GLIBCXX_BEGIN_NAMESPACE_CXX11
/**
* An iterator adaptor that will provide repeated calls of regex_search over
* a range until no more matches remain.
+ *
+ * @headerfile regex
+ * @since C++11
*/
template<typename _Bi_iter,
typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
* The purpose of this iterator is to enumerate all, or all specified,
* matches of a regular expression within a text range. The dereferenced
* value of an iterator of this class is a std::sub_match object.
+ *
+ * @headerfile regex
+ * @since C++11
*/
template<typename _Bi_iter,
typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,