[#boost-urls-pct_encoded_rule]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::pct&lowbar;encoded&lowbar;rule
:relfileprefix: ../../
:mrdocs:


Rule for a string with percent&hyphen;encoded escapes

== Synopsis


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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;xref:boost/urls/grammar.adoc[grammar]::xref:boost/urls/grammar/CharSet.adoc[CharSet] CS&gt;
constexpr
&sol;&ast; implementation-defined &ast;&sol;::xref:boost/urls/implementation_defined/pct_encoded_rule_t.adoc[pct&lowbar;encoded&lowbar;rule&lowbar;t]&lt;CS&gt;
pct&lowbar;encoded&lowbar;rule(CS const& cs) noexcept;
----

== Description


This function returns a rule which matches    a percent&hyphen;encoded string, permitting characters    in the string which are also in the specified    character set to be used unescaped&period;


=== Value Type

[,cpp]
----
using value_type = pct_string_view;
----

=== Example

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

[,cpp]
----
//  pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

system::result< pct_string_view > rv = grammar::parse( "Program%20Files", pct_encoded_rule( pchars ) );
----

=== BNF

[,cpp]
----
pct-encoded   = "%" HEXDIG HEXDIG
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-2.1[        2&period;1&period; Percent&hyphen;Encoding (rfc3986)]



== Parameters


|===
| Name | Description

| *cs*
| The character set indicating    which characters are allowed without escapes&period;    Any character which is not in this set must be    escaped, or else parsing returns an error&period;


|===

== See Also


xref:boost/urls/grammar/parse-02.adoc[grammar&colon;&colon;parse],        xref:boost/urls/pchars.adoc[pchars],        xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view]&period;






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