jmb has asked for the wisdom of the Perl Monks concerning the following question:
I wish to perform regex substitutions in a string containing Windows paths. More precisely, eliminate some paths from the string. Could someone help me out with the regex substitution, which does not seem work in the following code ?
I would appreciate if somebody explained what exactly the problem is. I fear it's something very basic that I am missing here..
Thank you in advance !#!/usr/bin/perl -w use strict; use warnings; my $path = join ';', ( 'D:\aa\bb\cc', 'D:\dd\ee\ff', 'D:\gg\hh\ii', ); my $path_component = 'D:\aa\bb\cc'; print $path, "\n\n"; $path =~ s/$path_component//i; print $path, "\n\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with regex substitution within windows paths
by Corion (Patriarch) on Jul 08, 2011 at 15:54 UTC | |
by halfcountplus (Hermit) on Jul 08, 2011 at 17:42 UTC | |
by jmb (Novice) on Jul 11, 2011 at 12:32 UTC |