> Hello [EMAIL PROTECTED]!
> 
> On 13-Feb-00, you wrote:
> 
> 
>  p> hname-rule: [name-rule some ["." name-rule]] name-rule:
>  p> [let-char [none | [[some let-digit-hyph-char] let-digit-char]]
>  p> to end]
> 
>  p> The problem is that it returns "true" too often...
> 
> This is caused by the "to end" above. It should work if you remove
> it.

Removing the "to end" did break the rule even more...

>> name-rule: [let-char [none | [[some let-digit-hyph-char] let-digit-char]]]
>> parse "a" name-rule                                                       
== true
OK              a single letter hostname part is ok

>> parse "a1" name-rule
== false
ERR!            two chars which the first one is a letter and the last is
                letter or digit is ok

>> parse "a1a" name-rule
== false
ERR!            should be ok

replacing "some" with "any" above caused the same error..

And.. the rule I came up with that I posted earlier...

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

didn't work with a two character name...

If I break down the rules...

; name must start with a letter
let-char

; may have any number of letters, digits and
; hyphens in between, but this sequence must
; end with a letter or digit if it exists
0 1 [any let-digit-hyph-char let-digit-char]

The problem is combining them to a working ruleset...

parse "a" name-rule should return "true"
parse "a1" name-rule should return "true"
parse "aa" name-rule should return "true"
parse "a-" name-rule should return "false"
parse "a-1" name-rule should return "true"

/PeO

Reply via email to