Re: Help with global match and replace

2001-11-19 Thread David Wall


[Fixed Jeopardy quoting]

[EMAIL PROTECTED] (Martin Pfeffer) wrote on 19 Nov 2001:
> FLAHERTY, JIM-CONT wrote:
> 
>> My script dumps file name into a mysql DB on redhat 7.1 linux . The
>> problem I have is sometime windows files has  a single quote  ( ' ) 
>> in the name. I want to replace it with a space . I not strong on
>> pattern matching in perl yet 
>> 
>> 
>> $thestring = "this isn't a good file name";
>
> $thestring =~ s/'/ /g;

If you're simply replacing one set of characters with another, the 
preferred function (actually an operator) is tr///

$thestring =~ tr/'/ /;

If tr/// is a shovel, then s/// is a bulldozer.  

-- 
David Wall
[EMAIL PROTECTED]

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




Re: Help with global match and replace

2001-11-19 Thread Martin Pfeffer

$thestring =~ s/'/ /g;
martin

FLAHERTY, JIM-CONT wrote:

> My script dumps file name into a mysql DB on redhat 7.1 linux . The problem
> I have is sometime windows files has  a single quote  ( ' )  in the name. I
> want to replace it with a space . I not strong on pattern matching in perl
> yet
> 
> 
> $thestring = "this isn't a good file name";
> 
> 
> 
> Help ,
> 
> thanks in advance 
> Jim F 
> 
> 



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




Help with global match and replace

2001-11-19 Thread FLAHERTY, JIM-CONT

My script dumps file name into a mysql DB on redhat 7.1 linux . The problem
I have is sometime windows files has  a single quote  ( ' )  in the name. I
want to replace it with a space . I not strong on pattern matching in perl
yet


$thestring = "this isn't a good file name";



Help ,

thanks in advance 
Jim F 

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