In general, a \ (backslash) introduces a regex zero-width assertion. Some such are \A \B \b \Z \z and there are others. Why do you need backslashes in your paths? Even in Perl running under Windows, forwardslashes work just as well unless you need to construct a command that is to be given to the Windows shell. I don't recall what assertion \C used to be, but clearly Perl does.
Update 1:
... in m/C:\Book\ <-- HERE C0001-Chapter-001.mp3/ ...Note that the \B assertion is also present in the
Update 2: See quotemeta:
Win8 Strawberry 5.8.9.5 (32) Fri 08/19/2022 19:42:14 C:\@Work\Perl\monks >perl use strict; use warnings; my $txt = "C:\\Book\\C0001-Chapter-001.mp3"; my $new = "C:\\Book\\NEW-C0001-Chapter-001.mp3"; print "\n"; print "Before: '$txt' \n"; # Workaround -- use \Q \E -- see quotemeta. $txt =~ s/\Q$txt\E/$new/; print "After: '$txt' \n"; print "\n"; ^Z Before: 'C:\Book\C0001-Chapter-001.mp3' After: 'C:\Book\NEW-C0001-Chapter-001.mp3'
Give a man a fish: <%-{-{-{-<
In reply to Re: Unexpected Error: \C no longer supported in regex (updated x2)
by AnomalousMonk
in thread Unexpected Error: \C no longer supported in regex
by roho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |