triyng to lower case the to letters and replace the digits with yy
It would help if you'd include a sample of the desired output, rather than just a description and sample code. However, if I understand you correctly, this will do:
$file =~ s/^(\w\w)\d+/\L$1yy/;Outputs:
xyyy.TXT twyy.TXT kgyy.TXT mmyy.TXT
If you need the entire filename in lowercase, I might use another statement for clarity:
$file =~ s/\d+/yy/; $file = lc $file;
In reply to Re: RegEx match in files
by rjt
in thread RegEx match in files
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |