> > name-rule: [let-char [none | [[some let-digit-hyph-char] let-digit-char]]
> to end]
> 
> Try:
>         let-char any [let-digit-hyp=char]
>     instead.
> 
The problem will be that it would then accept a "-" as the last character
in a part of the hostname...

Valid names are these starting with a letter, followed by an optional part
consisting of any number of letters and "-":es, but must end with a letter
or digit...

The problem with my original rule was that the
[some let-digit-hyph-char]

part matched all the way up to the end of the string that I tried to
parse.. (some should be "any", but that didn't help)

I came up with this rule that seems to be working:

name-rule: [ let-char [[any [[let-digit-hyph-char] let-digit-char]] | none]]

>> parse "a" name-rule
== true
>> parse "1" name-rule
== false
>> parse "a-" name-rule
== false
>> parse "a-1" name-rule
== true
>> parse "aaa-1" name-rule
== true

/PeO

Reply via email to