This is a BNF-like description of the URI syntax. at the level at which specific schemes are not considered.
A vertical line "|" indicates alternatives, and [brackets] indicate optional parts. Spaces are represented by the word "space", and the vertical line character by "vline". Single letters stand for single letters. All words of more than one letter below are entities described somewhere in this description.
The "generic" production gives a higher level parsing of the same URIs as the other productions. The "national" and "punctuation" characters do not appear in any productions and therefore may not appear in URIs.
fragmentaddress uri [ # fragmentid ] uri scheme : path [ ? search ] scheme ialpha path void | xpalphas [ / path ] search xalphas [ + search ] fragmentid xalphas xalpha alpha | digit | safe | extra | escape xalphas xalpha [ xalphas ] xpalpha xalpha | + xpalphas xpalpha [ xpalpha ] ialpha alpha [ xalphas ] alpha a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z digit 0 |1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 safe $ | - | _ | @ | . | & extra ! | * | " | ' | ( | ) | , reserved = | ; | / | # | ? | : | space escape % hex hex hex digit | a | b | c | d | e | f | A | B | C | D | E | F national { | } | vline | [ | ] | \ | ^ | ~ punctuation < | > void (end of URI BNF)