Hi John,

I found this regex by searching on google and I assumed the guy who wrote it knew more 
than me.

I am creating unix filenames on this project but Teamsite can also be run under a 
windows environment.

I guess I was looking for a general purpose regex to remove invalid characters from 
filenames to add to my developers toolkit to take from project to project.

>From the menu item entered into the primary menu template I need to generate a 
>filename.

Specifically for this project I would like to remove spaces and ampersands 
apostrophes, quotes should users enter them.

Regards
Colin



-----Original Message-----
From: John W. Krahn [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 14, 2004 4:06 PM
To: Perl Beginners
Subject: Re: Regex help


Johnstone, Colin wrote:
> Hi Jim,

Hello, (my name is John BTW)


> rather than re-invent the wheel I would prefer if you could fix this regex
> I believe it covers all invalid characters one would encounter
> 
> s/[<sup>\w\&amp;%'[EMAIL PROTECTED](\)&amp;_\</sup>\+,\.=\[\]]//g;

Most of those characters are valid in DOS file names and all except '/' are valid in 
Unix file names.  How do you define invalid?
You have '<', '>' and '_' listed twice and 's', 'u', 'a' and 'm' listed three 
times and 'p' listed five times because?
You are using '/' to delimit the regexp and string yet you have an unescaped 
'/' in the character class which is an error and will not compile.

Maybe it would be better if you tell us what characters you consider to be *VALID*.  
:-)


John
-- 
use Perl;
program
fulfillment

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




This E-Mail is intended only for the addressee. Its use is limited to that
intended by the author at the time and it is not to be distributed without the
author's consent. Unless otherwise stated, the State of Queensland accepts no
liability for the contents of this E-Mail except where subsequently confirmed in
writing. The opinions expressed in this E-Mail are those of the author and do
not necessarily represent the views of the State of Queensland. This E-Mail is
confidential and may be subject to a claim of legal privilege.

If you have received this E-Mail in error, please notify the author and delete this 
message immediately.


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