Project

General

Profile

Keep locator format » History » Version 2

Tom Clegg, 07/10/2014 01:52 PM

1 1 Tom Clegg
h1. Keep locator format
2
3
Draft. See discussion at #2755
4
5
<pre>
6
locator       ::= sized-digest hint*
7
8
sized-digest  ::= digest size-hint
9
10
digest        ::= <32 lowercase hexadecimal digits>
11
12
size-hint     ::= "+" [0-9]+
13
14
hint          ::= "+" hint-type hint-content
15
16
hint-type     ::= [A-Z]+
17
18
hint-content  ::= [A-Za-z0-9@_-]*
19
20
sign-hint      ::= "+A" <40 lowercase hexadecimal digits> "@" sign-timestamp
21
22
sign-timestamp ::= <8 lowercase hexadecimal digits>
23
</pre>
24 2 Tom Clegg
25
h2. Regular expressions
26
27
Is it a valid locator?
28
29
<pre>
30
/^([0-9a-f]{32})\+([0-9]+)(\+[A-Z][-A-Za-z0-9@_]*)*$/
31
</pre>
32
33
h2. Good examples
34
35
|@d41d8cd98f00b204e9800998ecf8427e+0@|
36
|@d41d8cd98f00b204e9800998ecf8427e+0+Z@|
37
|@d41d8cd98f00b204e9800998ecf8427e+0+Z+Ada39a3ee5e6b4b0d3255bfef95601890afd80709@53bed294@|
38
39
h2. Bad examples
40
41
||Why|
42
|@d41d8cd98f00b204e9800998ecf8427e@|No size hint|
43
|@d41d8cd98f00b204e9800998ecf8427e+Z+0@|Other hint before size hint|
44
|@d41d8cd98f00b204e9800998ecf8427e+0+0@|Multiple size hints|
45
|@d41d8cd98f00b204e9800998ecf8427e+0+z@|Hint does not start with uppercase letter|
46
|@d41d8cd98f00b204e9800998ecf8427e+0+Zfoo*bar@|Hint contains invalid character @*@|