These functions can be used when parsing email addresses and URL web addresses.
| Function | Description |
|---|---|
parse::email::host() | Parses and returns an email host from an email address |
parse::email::user() | Parses and returns an email username from an email address |
parse::url::domain() | Parses and returns the domain from a URL |
parse::url::fragment() | Parses and returns the fragment from a URL |
parse::url::host() | Parses and returns the hostname from a URL |
parse::url::path() | Parses and returns the path from a URL |
parse::url::port() | Parses and returns the port number from a URL |
parse::url::scheme() | Parses and returns the scheme from a URL |
parse::url::query() | Parses and returns the query string from a URL |
parse::email::hostThe parse::email::host function parses and returns an email host from a valid email address.
API DEFINITIONparse::email::host(string) -> string
The following example shows this function, and its output, when used in a RETURN statement:
RETURN parse::email::host("info@surrealdb.com"); "surrealdb.com"
parse::email::userThe parse::email::user function parses and returns an email username from a valid email address.
API DEFINITIONparse::email::user(string) -> string
The following example shows this function, and its output, when used in a RETURN statement:
RETURN parse::email::user("info@surrealdb.com"); "info"
parse::url::domainThe parse::url::domain function parses and returns domain from a valid URL. This function is similar to parse::url::host only that it will return null if the URL is an IP address.
API DEFINITIONparse::url::domain(string) -> string
The following example shows this function, and its output, when used in a RETURN statement:
RETURN parse::url::domain("https://surrealdb.com:80/features?some=option#fragment"); RETURN parse::url::domain("http://127.0.0.1/index.html");
Response"surrealdb.com" null
parse::url::fragmentThe parse::url::fragment function parses and returns the fragment from a valid URL.
API DEFINITIONparse::url::fragment(string) -> string
The following example shows this function, and its output, when used in a RETURN statement:
RETURN parse::url::fragment("https://surrealdb.com:80/features?some=option#fragment"); "fragment"
parse::url::hostThe parse::url::host function parses and returns the hostname from a valid URL.
API DEFINITIONparse::url::host(string) -> string
The following example shows this function, and its output, when used in a RETURN statement:
RETURN parse::url::host("https://surrealdb.com:80/features?some=option#fragment"); RETURN parse::url::host("http://127.0.0.1/index.html");
Response"surrealdb.com" "127.0.0.1"
parse::url::pathThe parse::url::path function parses and returns the path from a valid URL.
API DEFINITIONparse::url::path(string) -> string
The following example shows this function, and its output, when used in a RETURN statement:
RETURN parse::url::path("https://surrealdb.com:80/features?some=option#fragment"); "/features"
parse::url::portThe parse::url::port function parses and returns the port from a valid URL.
API DEFINITIONparse::url::port(string) -> number
The following example shows this function, and its output, when used in a RETURN statement:
RETURN parse::url::port("https://surrealdb.com:80/features?some=option#fragment"); 80
parse::url::schemeThe parse::url::scheme function parses and returns the scheme from a valid URL, in lowercase, as an ASCII string without the ’:’ delimiter.
API DEFINITIONparse::url::scheme(string) -> string
The following example shows this function, and its output, when used in a RETURN statement:
RETURN parse::url::scheme("https://surrealdb.com:80/features?some=option#fragment"); 'https'
parse::url::queryThe parse::url::query function parses and returns the query from a valid URL.
API DEFINITIONparse::url::query(string) -> string
The following example shows this function, and its output, when used in a RETURN statement:
RETURN parse::url::query("https://surrealdb.com:80/features?some=option#fragment"); "some=option"