in reply to RegEx match in files
If you are using the /e option of the substitution, make sure the string is a valid Perl expression:
$file =~ s/(\w{2})(\d+)/$1 . lc($1) . $2 . lc("yy")/e;
Update: If you do not want to use the numbers, do not capture (and output) them:
$file =~ s/(\w{2})\d+/$1 . lc($1) . "yy"/e;
Note that you can use the \L special character instead of the lc function, which means you do not need the /e option at all:
$file =~ s/(\w{2})\d+/\L$1yy/;
|
|---|