in reply to Getting server share and path from a Microsoft UNC
I want to split it at the first single '\'Well you can split on the first '\' and you can use the 3rd argument of split to get 2 separate strings, but it won't do quite what you want, as you'll lose the '\'. If you want to split in the middle of a string then it'll be easier just to match it
my $str = q[\\\\Srvbuild\e\ADW61\VENDOR\MICROSOFT\PLATFORMSDK\INCLUDE]; my($network, $path) = $str =~ m<^ ( (?:\\+ \w+){2} )(.*)>x; print "network - $network", $/, "path - $path", $/; __output__ network - \\Srvbuild\e path - \ADW61\VENDOR\MICROSOFT\PLATFORMSDK\INCLUDE
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: split
by Anonymous Monk on Jun 07, 2002 at 13:13 UTC |