Project

General

Profile

Keep locator format » History » Revision 2

Revision 1 (Tom Clegg, 07/10/2014 11:42 AM) → Revision 2/3 (Tom Clegg, 07/10/2014 01:52 PM)

h1. Keep locator format 

 Draft. See discussion at #2755 

 <pre> 
 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> 
 </pre> 

 h2. Regular expressions 

 Is it a valid locator? 

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

 h2. Good examples 

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

 h2. 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 @*@|