Description
Return host, literal port or empty string, and explicitEmpty only when a colon was present with no digits.
URI text contains components and percent-encoded octets. A percent sign plus two hex digits describes one octet, while UTF-8 decoding and component-specific validity are additional questions. Host and port notation also needs to distinguish an absent field from an explicitly empty one.
Return host, literal port or empty string, and explicitEmpty only when a colon was present with no digits.
When to use this tool
Use URI Authority Empty Port Marker when you need this local percent-encoding or host/port-notation check on supplied text.
How to use the tool and how it works
- Enter authority. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read host, port, explicitEmpty. Inspect explicitEmpty before interpreting the associated values.
Match a bracketed host-like token or a noncolon/nonwhitespace token, optionally followed by : and zero or more decimal digits. Return host, literal port or empty string, and explicitEmpty only when a colon was present with no digits.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| authority | Authority | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| host | Host | Required. Text; maximum UTF-16 length 8192. |
| port | Port | Required. Text; maximum UTF-16 length 8192. |
| explicitEmpty | True for a supplied colon followed by no port digits; false when the port is absent. | Required. Boolean. |
{
"input": {
"authority": "example.com:"
},
"output": {
"host": "example.com",
"port": "",
"explicitEmpty": true
}
} Limitations and assumptions
- A missing port and an explicit empty port have the same port string but different flags. IP syntax, port range, userinfo, component delimiters, and an actual URI authority are not fully validated.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Use a URI parser and component-appropriate decoding when a full address is needed. Verify octet encoding, UTF-8 interpretation, component boundaries, and endpoint constraints separately.
References
Similar or alternative tools
- Parsing: URI Percent Triplet Position
Locate percent signs that begin valid two-hex-digit URI octet escapes and invalid percent positions using UTF-16 offsets; does not decode or normalize a URI.
- HTTP Range Single Suffix Token
Return length as a nonnegative safe integer and nonzero when length>0.