[#boost-urls-query_rule]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::query&lowbar;rule
:relfileprefix: ../../
:mrdocs:

Rule for a query string

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/rfc/query_rule.hpp#L70[boost&sol;url&sol;rfc&sol;query&lowbar;rule&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr &sol;&ast; implementation-defined &ast;&sol; query&lowbar;rule = &lcub;&rcub;;
----

== Value Type

[,cpp]
----
using value_type = params_encoded_view;
----
== Example

Rules are used with the function xref:boost/urls/grammar/parse-09.adoc[`grammar&colon;&colon;parse`]&period;

[,cpp]
----
system::result< params_encoded_view > rv = grammar::parse( "format=web&id=42&compact", query_rule );
----
== BNF

[,cpp]
----
query           = *( pchar / "/" / "?" )

query-params    = [ query-param ] *( "&" query-param )
query-param     = key [ "=" value ]
key             = *qpchar
value           = *( qpchar / "=" )
qpchar          = unreserved
                / pct-encoded
                / "!" / "$" / "'" / "(" / ")"
                / "*" / "+" / "," / ";"
                / ":" / "@" / "/" / "?"
----
== Specification

* https://datatracker.ietf.org/doc/html/rfc3986#section-3.4[3&period;4&period; Query (rfc3986)]

== See Also

xref:boost/urls/grammar/parse-09.adoc[`grammar&colon;&colon;parse`], xref:boost/urls/params_encoded_view.adoc[`params&lowbar;encoded&lowbar;view`]&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
