On Sun, 2006-25-06 at 00:14 +0500, Sara wrote:
> Need help to remove EVERY thing (non-alphabets, symbols, ASCII codes etc) 
> from a string except for a-zAZ, 0-9, dash and underscore.
> 
> $string =~ s/??????
> 
> Thanks,
> Sara.
> 

By dash, I assume you mean ASCII character 0x2D.

English version:

  $string =~ s/[^-0-9A-Za-z_]//g;

Non-English version:

  use locale;
  use POSIX;

  $string =~ s/[^-[:alnum:]]//g;

See:
  perldoc perlretut
  perldoc perlre
  perldoc locale
  perldoc POSIX


-- 
__END__

Just my 0.00000002 million dollars worth,
   --- Shawn

"For the things we have to learn before we can do them, we learn by doing them."
  Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to