in reply to isAlpha / isNumeric

All the solutions that have been posted so far have serious internationalization/localization problem. They all make the assumption that A-Za-z are the only alphabetic characters. This is a very short-sighetd assumption. You're better off using the POSIX isalpha or isdigit functions which are locale aware.

Replies are listed 'Best First'.
Re: Re: isAlpha / isNumeric
by Trimbach (Curate) on Mar 22, 2001 at 18:15 UTC
    ...well, yeah. But if you ask me an "alphabet" regex (in any alphabet) has pretty limited utility. I've always used /\w/ which at least in Perl 5.6 is Internationalized (I think.)

    And without sparking any huge debate on the merits of internationalization everyone should program to the type of data they expect to have to deal with. If the poster's code is going to be used in an environment of all-English speakers there's no internationalization problem at all. If it's in a CGI on the Internet he/she may want to consider other options. Limiting code to one language is not prima facia a bad thing... internationalization is just one more area to optimize if you need it.

    Gary Blackburn
    Trained Killer

      I think that it is very shortsighted to assume that your "alphabet" is only A-Z when you can support characters from other alphabets with in your code with no additional effort. Even if your applicaiton is %100 targeted to a English speaking, US audience you will run into occasions where you want to use accented characters: El Niño, Björk, Café, etc.... IMHO, limiting your code to work on A-Z only is asking for trouble later on (like using a 2 digit year). Why limit yourself when you don't have to?
Re: Re: isAlpha / isNumeric
by Jamnet (Scribe) on Mar 23, 2001 at 11:20 UTC
    Hi lhoward,

    Thanks a lot for your support.

    Regards

    Joel