> Hi all,

Hi

> 
> create a filename.
> 
> I firstly need to remove any invalid characters (including spaces)

What do you consider invalid chars? Do you want just alpha cars? 

> 
> $filename = 'News & events';
> $filename =~ 
> s/[<sup>\w\&amp;%'[EMAIL PROTECTED](\)&amp;_\</sup>\+,\.=\[\]]//g; 
> 
> then convert it to lowercase.

$filename =~ s/[^A-Za-z]//g; #use only alpha chars
print lc($filename); # convert to lower case

# or if you want to strip out non printing (control) chars:
$filename = " News \r \n \x01 even ts";
$filename =~ s/[[:cntrl:]]//g;
$filename =~ s/\s//g;
print lc($filename);

That help at all?
Jim







---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.745 / Virus Database: 497 - Release Date: 8/27/2004
 


-- 
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