Hi Andreas :) * Andreas Schwab <[EMAIL PROTECTED]> dixit: > > returns 1, correctly. That is, 'expr' understands character > > classes but it needs that double bracket :( > The syntax of a character class is [:CLASS:], _including_ the brackets. > Thus to build a regular expression that matches a single lower case letter > or digit or underscore, you write "[[:lower:][:digit:]_]".
You're right, I missed a paragraph in SUSv3: The character sequences "[." , "[=" , and "[:" (left-bracket followed by a period, equals-sign, or colon) shall be special inside a bracket expression and are used to delimit collating symbols, equivalence class expressions, and character class expressions. These symbols shall be followed by a valid expression and the matching terminating sequence ".]" , "=]" , or ":]" , as described in the following items. My fault, sorry for the idiocy :( > > and other binaries like 'tr' > `tr' doesn't expect regular expressions as arguments, but rather they are > interpreted as character sets without the surrounding brackets. True, and the worst thing is that I tested the following: $ echo "xalt" | grep "[:alpha:]" which obviously matches, but not because grep is interpreting the character class... is because that 'a' and 'l' in 'xalt'. My excuses, and sorry for the noise. Next time I'll read the standard with more attention :( You've been so kind for explaining, thanks a lot :) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/ _______________________________________________ Bug-coreutils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-coreutils