RegEx: odd number of slashes? and too many slashes?
- From: Dan Wilkin <nibbles.bits@xxxxxxxxxxx>
- Date: Mon, 17 Jul 2006 03:20:44 GMT
Why does the following code work to find the literal UNC path specified. altPath should have worked, right? It looks like the regex engine is gobbling up slashes!! Perl 5.x
#my $altPath = '\\\\websrv\\VMServer\\cvs\\SAMS\\archives';
my $rootPath = '\\\\\\\websrv\\\VMServer\\\cvs\\\SAMS\\\archives';
# load the list of obsolete files
sub loadObsoletes {
my $i = 0;
my $line;
open SRC, $src_name or die "Can't open file '$src_name'";
while (<SRC>) {
chomp;
/$rootPath(.+?)-arc - (.+)/o; # extract the filenames into an array
print "Matched: <$`> $& <$'>\n";
print "Parsed line $i as: {$1}{$2}\n" if $verbose;
$line = $1;
$line =~ s[\\][/]g;
print "Subst as: {$line}\n" if $verbose;
$LoF[$i] = $line;
$i++;
}
close SRC;
print "Listed source file as: @LoF" if $verbose;
}
Thnx,
Dan
.
- Follow-Ups:
- Re: RegEx: odd number of slashes? and too many slashes?
- From: A. Sinan Unur
- Re: RegEx: odd number of slashes? and too many slashes?
- From: robic0
- Re: RegEx: odd number of slashes? and too many slashes?
- Prev by Date: Re: How get UTF-8 from urlencoded web form
- Next by Date: Re: CPANPLUS on debian headache
- Previous by thread: FAQ 2.3 I don't have a C compiler. How can I build my own Perl interpreter?
- Next by thread: Re: RegEx: odd number of slashes? and too many slashes?
- Index(es):