How about providing the code that you are working with? This ought to work: s/C:\\Dir 1\\Dir 2\\Dir with more spaces/replacement/
__CODE__ $in = 'C:\Dir 1\Dir 2\Dir with more spaces'; $in =~ s/C:\\Dir 1\\Dir 2\\Dir with more spaces/replacement/; print "$in\n"; __OUTPUT__ replacement