I think both in sed and perl you can use any symbols you wish to delineate the RegEx. # works, but / is traditionally used in Perl. That is to say, in Perl these two lines are the same:
$in =~ s/C:\\Dir 1\\Dir 2\\Dir with more spaces/replacement/; $in =~ s#C:\\Dir 1\\Dir 2\\Dir with more spaces#replacement#; And, yeah, there ought to be a trailing i to make it case insensitive.