Can someone please tell me how the following regex resolves? I am trying to upload an app to Appspot, and am getting an error that my name does not meet the following criteria:
^(?:[a-z\d\-]{1,100}\~)?(?:(?!\-)[a-z\d\-\.]{1,100}:)?(?!-)[a-z\d\-]{1,100}$
Pretty complex, but I’ll try and boil the rules down to English.
There is only one tilde (~) allowed in the name, but it is optional. If there is a tilde, it must not be the first character in the name, it must have at least 1 and at most 100 letters, numbers or dashes in front of it.
There is only one colon (:) allowed in the name, and it is optional. If there is a colon, it must:
a. come after the tilde, if present.
b. come after 1 or more letters, numbers, dashes or full stops.
c. the group of letters, numbers, dashes and full stops cannot start with a dash.
The rest of the name can contain any letter, number or dashes, up to a hundred characters. The optional tilde and colon sections must come before it, and it cannot start with a dash. You must use at least one character, and at most 100.
Some examples that are allowed:
foo~bar.baz:spam-eggs
something:other-
whomever~thought-this-was-a-good-idea
together.we.stand:strong
simply-should-work
-starting-dash~as.long.as.there.is.a:tilde-after-it
Some examples that won’t be allowed:
-no-starting-dash
-no-starting-dash:with-a-colon-but-no-tilde
no.full.stops.without.a.colon.after.it
~no-tilde-at-the-start
:no-colon-at-the-start
more~than~one:tilde:or:colon