[#boost-urls-parse_authority]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::parse&lowbar;authority
:relfileprefix: ../../
:mrdocs:


Parse an authority

== Synopsis


Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1449[boost&sol;url&sol;authority&lowbar;view&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
system::result&lt;xref:boost/urls/authority_view.adoc[authority&lowbar;view]&gt;
parse&lowbar;authority(core::string&lowbar;view s) noexcept;
----

== Description


This function parses a string according to    the authority grammar below, and returns an    xref:boost/urls/authority_view.adoc[authority&lowbar;view] referencing the string&period;    Ownership of the string is not transferred&semi;    the caller is responsible for ensuring that    the lifetime of the string extends until the    view is no longer being accessed&period;


=== BNF

[,cpp]
----
authority     = [ userinfo "@" ] host [ ":" port ]

userinfo      = user [ ":" [ password ] ]

user          = *( unreserved / pct-encoded / sub-delims )
password      = *( unreserved / pct-encoded / sub-delims / ":" )

host          = IP-literal / IPv4address / reg-name

port          = *DIGIT
----

=== Exception Safety

Throws nothing&period;


=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3&period;2&period; Authority (rfc3986)]



== Return Value


A view to the parsed authority



== Parameters


|===
| Name | Description

| *s*
| The string to parse


|===

== See Also


xref:boost/urls/authority_view.adoc[authority&lowbar;view]&period;






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