On Mon, Jul 23, 2001 at 04:53:28PM -0400, Jeff 'japhy/Marillion' Pinyan wrote:
> Hopefully, in Perl 5.8 or Perl 6, there will be a much simpler character
> class subtraction syntax:
>
> if ($name =~ /^[\w&&[^0-9_]]+$/) {
> # valid
> }
>
> which reads "\w AND NOT 0-9_".
I was under the impression the proposed syntax was:
[\w[^0-9_]]+
i.e. without the &&. I'm fine with that, but the addition of && becomes
confusing, not to mention backwards-incompatible: is the intent to match an
&, and the second was a typo, or is it a logical 'and'? It also implies
there could be ||, !, etc. The benefits to turning a character class into a
big conditional don't outweigh (IMHO) the confusion introduced if the
feature is ever used.
To solve the immediate problem, though, and with the most recent stable
version of Perl, you could simply say:
/^[[:alpha:]]$/
However, the original question asked about matching German umlauts, failing
to specify under what conditions. Neither \w nor [:alpha:] will match a any
international characters unless the locale is changed, which may not be
feasible. If the locale cannot be changed then the solution involves
finding the international characters in a given character set and adding
those to the character class. This is assuming the character set can't
change.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]