:relfileprefix: ../../../ [#boost-urls-grammar-range_rule-00] == xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/grammar.adoc[pass:[grammar]]::range_rule Match a repeating number of elements === Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- template constexpr pass:q[_implementation-defined_] range_rule( Rule const& next, std::size_t N = 0, std::size_t M = std::size_t(-1)) noexcept; ---- === Description Elements are matched using the passed rule. Normally when the rule returns an error, the range ends and the input is rewound to one past the last character that matched successfully. However, if the rule returns the special value xref:boost/urls/grammar/error/end_of_range.adoc[error::end_of_range] , the input is not rewound. This allows for rules which consume input without producing elements in the range. For example, to relax the grammar for a comma-delimited list by allowing extra commas in between elements. [,cpp] ---- using value_type = range< typename Rule::value_type >; ---- === Rules are used with the function xref:boost/urls/grammar/parse-02.adoc[parse] . [,cpp] ---- // range = 1*( ";" token ) system::result< range > rv = parse( ";alpha;xray;charlie", range_rule( tuple_rule( squelch( delim_rule( ';' ) ), token_rule( alpha_chars ) ), 1 ) ); ---- [,cpp] ---- range = *next ---- * link:https://datatracker.ietf.org/doc/html/rfc5234#section-3.6[3.6. Variable Repetition (rfc5234)] === Parameters |=== | Name | Description | *next* | The rule to use for matching each element. The range extends until this rule returns an error. | *N* | The minimum number of elements for the range to be valid. If omitted, this defaults to zero. | *M* | The maximum number of elements for the range to be valid. If omitted, this defaults to unlimited. |=== === See Also xref:boost/urls/grammar/alpha_chars.adoc[alpha_chars] , xref:boost/urls/grammar/delim_rule-0a.adoc[delim_rule] , xref:boost/urls/grammar/error/end_of_range.adoc[error::end_of_range] , xref:boost/urls/grammar/parse-02.adoc[parse] , xref:boost/urls/grammar/range.adoc[range] , xref:boost/urls/grammar/tuple_rule.adoc[tuple_rule] , xref:boost/urls/grammar/squelch.adoc[squelch] .