May URL scheme contain an underscore?

2019-03-28 01:03发布

问题:

According to the spec for URL, can the scheme have an underscore? E.g., is web_view://example.com a valid URL?

回答1:

No.

A valid RFC 3986 URL scheme must consist of "a letter and followed by any combination of letters, digits, plus ("+"), period ("."), or hyphen ("-")."

    scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )