Couple of different possibilities:

m/^(\\\\[A-Za-z0-9]+)\\(.*)$/;

$server = $1;
$pathname = $2;

Assuming the original path is in $_.

Or you could split the original path on "\":

@path = split(/\\/);
$server = "\\$path[0]";
$path = join("\\", @path[1..$#path]);

-Peter

-----Original Message-----
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 5/13/2002 3:08 PM
Subject: regular expression help

I'm a little bit rusty on using regular expressions and need some help.
Let's say that I'm given \\Server\Pathname as a text.  How would I
extract
"\\Server" from this and store it to a variable $server?

Thanks,
Jason

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to