Skip to main content

Introduction

http://example.com/~fred/
http://example.com/~mark/
http://example.com/dictionary/c/cat
http://example.com/dictionary/d/dog
http://example.com/search?q=cat&lang=en
http://example.com/search?q=chien&lang=fr
http://example.com/~{username}/
http://example.com/dictionary/{term:1}/{term}
http://example.com/search{?q,lang}
http://www.example.com/foo{?query,number}
http://www.example.com/foo{?query,number}
\_____________/
|
|
query := "mycelium"
number := 100
http://www.example.com/foo?query=mycelium&number=100
http://www.example.com/foo?number=100
http://www.example.com/foo
.-----------------------------------------------------------------.
| |
| var := "value" |
| hello := "Hello World!" |
| |
|-----------------------------------------------------------------|
| Op Expression Expansion |
|-----------------------------------------------------------------|
| |
| {var} value |
| {hello} Hello%20World%21 |
`-----------------------------------------------------------------'
.-----------------------------------------------------------------.
| |
| var := "value" |
| hello := "Hello World!" |
| path := "/foo/bar" |
| |
|-----------------------------------------------------------------|
| Op Expression Expansion |
|-----------------------------------------------------------------|
| |
| {+var} value |
| {+hello} Hello%20World! |
| {+path}/here /foo/bar/here |
| here?ref={+path} here?ref=/foo/bar |
|-----+---------------------------------------------------------------|
| |
| X{#var} X#value |
| X{#hello} X#Hello%20World! |
`-----------------------------------------------------------------'
.-----------------------------------------------------------------.
|                                                                 |
|   var := "value"                                                |
|   hello := "Hello World!"                                       |
|   empty := ""                                                   |
|   path := "/foo/bar"                                            |
|   x := "1024"                                                   |
|   y := "768"                                                    |
|                                                                 |
|-----------------------------------------------------------------|
|  Op    Expression        Expansion                              |
|-----------------------------------------------------------------|
|                                                                 |
|        map?{x,y}         map?1024,768                           |
|        {x,hello,y}       1024,Hello%20World%21,768              |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {+x,hello,y}      1024,Hello%20World!,768                |
|        {+path,x}/here    /foo/bar,1024/here                     |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {#x,hello,y}      #1024,Hello%20World!,768               |
|        {#path,x}/here    #/foo/bar,1024/here                    |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        X{.var}           X.value                                |
|        X{.x,y}           X.1024.768                             |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {/var}            /value                                 |
|        {/var,x}/here     /value/1024/here                       |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {;x,y}            ;x=1024;y=768                          |
|        {;x,y,empty}      ;x=1024;y=768;empty                    |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {?x,y}            ?x=1024&y=768                          |
|        {?x,y,empty}      ?x=1024&y=768&empty=                   |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        ?fixed=yes{&x}    ?fixed=yes&x=1024                      |
|        {&x,y,empty}      &x=1024&y=768&empty=                   |
|                                                                 |
`-----------------------------------------------------------------'
.-----------------------------------------------------------------.
|                                                                 |
|   var := "value"                                                |
|   hello := "Hello World!"                                       |
|   path := "/foo/bar"                                            |
|   list := ("red", "green", "blue")                              |
|   keys := [("semi",";"),("dot","."),("comma",",")]              |
|                                                                 |
|  Op    Expression        Expansion                              |
|-----------------------------------------------------------------|
|                                                                 |
|        {var:3}           val                                    |
|        {var:30}          value                                  |
|        {list}            red,green,blue                         |
|        {list*}           red,green,blue                         |
|        {keys}            semi,%3B,dot,.,comma,%2C               |
|        {keys*}           semi=%3B,dot=.,comma=%2C               |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {+path:6}/here    /foo/b/here                            |
|        {+list}           red,green,blue                         |
|        {+list*}          red,green,blue                         |
|        {+keys}           semi,;,dot,.,comma,,                   |
|        {+keys*}          semi=;,dot=.,comma=,                   |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {#path:6}/here    #/foo/b/here                           |
|        {#list}           #red,green,blue                        |
|        {#list*}          #red,green,blue                        |
|        {#keys}           #semi,;,dot,.,comma,,                  |
|        {#keys*}          #semi=;,dot=.,comma=,                  |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        X{.var:3}         X.val                                  |
|        X{.list}          X.red,green,blue                       |
|        X{.list*}         X.red.green.blue                       |
|        X{.keys}          X.semi,%3B,dot,.,comma,%2C             |
|        X{.keys*}         X.semi=%3B.dot=..comma=%2C             |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {/var:1,var}      /v/value                               |
|        {/list}           /red,green,blue                        |
|        {/list*}          /red/green/blue                        |
|        {/list*,path:4}   /red/green/blue/%2Ffoo                 |
|        {/keys}           /semi,%3B,dot,.,comma,%2C              |
|        {/keys*}          /semi=%3B/dot=./comma=%2C              |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {;hello:5}        ;hello=Hello                           |
|        {;list}           ;list=red,green,blue                   |
|        {;list*}          ;list=red;list=green;list=blue         |
|        {;keys}           ;keys=semi,%3B,dot,.,comma,%2C         |
|        {;keys*}          ;semi=%3B;dot=.;comma=%2C              |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {?var:3}          ?var=val                               |
|        {?list}           ?list=red,green,blue                   |
|        {?list*}          ?list=red&list=green&list=blue         |
|        {?keys}           ?keys=semi,%3B,dot,.,comma,%2C         |
|        {?keys*}          ?semi=%3B&dot=.&comma=%2C              |
|                                                                 |
|-----+---------------------------------------------------------------|
|                                                                 |
|        {&var:3}          &var=val                               |
|        {&list}           &list=red,green,blue                   |
|        {&list*}          &list=red&list=green&list=blue         |
|        {&keys}           &keys=semi,%3B,dot,.,comma,%2C         |
|        {&keys*}          &semi=%3B&dot=.&comma=%2C              |
|                                                                 |
`-----------------------------------------------------------------'
ALPHA          =  %x41-5A / %x61-7A   ; A-Z / a-z
DIGIT = %x30-39 ; 0-9
HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"

pct-encoded = "%" HEXDIG HEXDIG
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="

ucschar = %xA0-D7FF / %xF900-FDCF / %xFDF0-FFEF
/ %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD
/ %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD
/ %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD
/ %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD
/ %xD0000-DFFFD / %xE1000-EFFFD

iprivate = %xE000-F8FF / %xF0000-FFFFD / %x100000-10FFFD