Thanks Wags, terrific.

Colin





"Wagner, David --- Senior Programmer Analyst --- WGO" 
<[EMAIL PROTECTED]>
13/01/2004 12:03 PM

 
        To:     Colin Johnstone/Australia/Contr/[EMAIL PROTECTED], <[EMAIL PROTECTED]>
        cc: 
        Subject:        RE: Reg ex help



Colin Johnstone wrote:
> Gidday list,
> 
> Please I need a reg ex to return everything to the left of '\WORKAREA'
> 
> in this URL
> 
> $url = 'Y:\default\main\aphrwebAdmin\WORKAREA\Colin'
> 
> I tried
> 
> $url =~ s/(.*?)[\\WORKAREA]/$1/;
> 
> then we wish to remove the drive designation and the leading slash
> 
> Thanking you in anticipation
> 
> Colin
 Here is a shot.  When you use [] you are taking about a character class, 
which is not what you want.

I assume that instead of two passes, you could do one to rid yourself of 
the drive, colon and slash:

use strict;
my $url = 'Y:\default\main\aphrwebAdmin\WORKAREA\Colin';
$url =~ s/^.:.(.*?)\\WORKAREA/$1/;

printf "%-s\n", $url;

which prints out:

default\main\aphrwebAdmin\Colin


Wags ;)


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


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