IIIF/presentation-validator

Possible pattern improvement in format pattern of the JSON schema?

giacomomarchioro opened this issue · 0 comments

Hello,
thanks again for this schema, extremely helpful, just wondering the following regex pattern:

"pattern": "^[a-z][a-z]*/.*$"

matches image/format and also image//format is this the expected behaviour?
If it is correct I would consider escaping the forward-slash as suggested here because this could cause an error when using the pattern with Javascript. The resulting pattern would be:

"pattern": "^[a-z][a-z]*\/.*$"

Otherwise, the following pattern does not match image//format but only image/format

^[a-z][a-z]*(?<!\/)\/(?!\/).*$

some tests here