Validates if a given string is a properly encoded URI.
This function checks if the input string remains unchanged after being decoded and then re-encoded, which indicates that it's a valid URI.
validateURI("https://example.com"); // Returns truevalidateURI("https://example.com/path with spaces"); // Returns falsevalidateURI("https://example.com/path%20with%20spaces"); // Returns true Copy
validateURI("https://example.com"); // Returns truevalidateURI("https://example.com/path with spaces"); // Returns falsevalidateURI("https://example.com/path%20with%20spaces"); // Returns true
The string to be validated as a URI.
A boolean indicating whether the input is a valid URI (true) or not (false).
Validates if a given string is a properly encoded URI.
This function checks if the input string remains unchanged after being decoded and then re-encoded, which indicates that it's a valid URI.
Example