Il giorno Thu, 15 Mar 2007 07:38:46 +0100 Ola Lundqvist <[EMAIL PROTECTED]> ha scritto:
> > > > That should be > > [[:lower:][:digit:]]*(*([[:lower:][:digit:]_-])[[:lower:][:digit:]])) > > But this regex still allow -a, right? Mmh, no... well, it doesn't here :). > > Please use [:class:] instead of [a-z] as the latter is locale > > dependant and, while it seems reverted on recent bash, i think i > > can remember that a not-so-old release of bash broke it down > > ( well, the bash is/was right, the scripts aren't ). > > Hmm, well I'm not sure if I want to allow other letters than that. Not sure I'm following you here. [[:lower:]] is the same that [a-z], but better :): [EMAIL PROTECTED]:~/test$ touch a A b B y Y z Z [EMAIL PROTECTED]:~/test$ echo $LC_COLLATE C [EMAIL PROTECTED]:~/test$ ls [a-z] a b y z [EMAIL PROTECTED]:~/test$ ls [[:lower:]] a b y z [EMAIL PROTECTED]:~/test$ export LC_COLLATE="[EMAIL PROTECTED]" [EMAIL PROTECTED]:~/test$ ls [a-z] a A b B y Y z [EMAIL PROTECTED]:~/test$ ls [[:lower:]] a b y z As said, it seems that now ( at least etch - bash 3.1dfsg-8 ) the "case .. in" match follows the COLLATE=C behaviour, but anyway [:class:] should be a safer choice. > Do posix allow other letters? Tried to quickly dig into SUSv3 w/o finding any reference to it ( please note that "I haven't found" != "there's none" ). Anyway IMHO trying to melt down POSIX, DNS, RFC, conventions and various implementations is really a pain and I'm not sure the OP was kidding when said you, as the coder, have to take your decision ( i assume you already did, i.e., when allowed only lower characters ). As for my ( very personal ) thought I'd use [[:alnum:]]*(*([[:alnum:]-])[[:alnum:]]) ( note the lacking of dash and the case insensitive match ) that IMHO should be a valid rfc hostname ( apart from not enforcing an upper lenght limit ), as the 2-characters lower limit isn't so clearly affirmed ( think about the DN root servers ). Ciao, Gian Piero. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]