:relfileprefix: ../../
[#boost-urls-parse_authority]

== xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::parse_authority


Parse an authority


=== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L1449[boost/url/authority_view.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
system::result<xref:boost/urls/authority_view.adoc[authority_view]>
parse_authority(core::string_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_view]
referencing the string.
Ownership of the string is not transferred;
the caller is responsible for ensuring that
the lifetime of the string extends until the
view is no longer being accessed.
[,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
----

=== Throws nothing.

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2[3.2. 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_view]
.



