Project

General

Profile

Actions

Keep locator format » History » Revision 2

« Previous | Revision 2/3 (diff) | Next »
Tom Clegg, 07/10/2014 01:52 PM


Keep locator format

Draft. See discussion at #2755

locator       ::= sized-digest hint*

sized-digest  ::= digest size-hint

digest        ::= <32 lowercase hexadecimal digits>

size-hint     ::= "+" [0-9]+

hint          ::= "+" hint-type hint-content

hint-type     ::= [A-Z]+

hint-content  ::= [A-Za-z0-9@_-]*

sign-hint      ::= "+A" <40 lowercase hexadecimal digits> "@" sign-timestamp

sign-timestamp ::= <8 lowercase hexadecimal digits>

Regular expressions

Is it a valid locator?

/^([0-9a-f]{32})\+([0-9]+)(\+[A-Z][-A-Za-z0-9@_]*)*$/

Good examples

d41d8cd98f00b204e9800998ecf8427e+0
d41d8cd98f00b204e9800998ecf8427e+0+Z
d41d8cd98f00b204e9800998ecf8427e+0+Z+Ada39a3ee5e6b4b0d3255bfef95601890afd80709@53bed294

Bad examples

Why
d41d8cd98f00b204e9800998ecf8427e No size hint
d41d8cd98f00b204e9800998ecf8427e+Z+0 Other hint before size hint
d41d8cd98f00b204e9800998ecf8427e+0+0 Multiple size hints
d41d8cd98f00b204e9800998ecf8427e+0+z Hint does not start with uppercase letter
d41d8cd98f00b204e9800998ecf8427e+0+Zfoo*bar Hint contains invalid character *

Updated by Tom Clegg over 10 years ago · 3 revisions