On Dec 6, Daniel Falkenberg said:

>$string =~ s/[^a-zA-Z0-9]//g;
>
>I take it only allows $string to eq anthing in the charcter class of
>a-z, A-Z and 0-9.  I also take it that anything other than that will be
>stripped out?  Any other comments?

Right.  I'd write it as

  s/[^a-zA-Z0-9]+//g;

for "efficiency".  Or perhaps as

  tr/a-zA-Z0-9//cd;

for "clarity".  Your ideas of "efficiency" and "clarity" may differ.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to