in reply to Re: Perl file name parsing - Regular expression
in thread Perl file name parsing - Regular expression

Thank you so much.
for (@files) { if (/ ^ [\w_-]+ \. [\w:]+ \. [\w_-]+ \. ErrorLog $ /x) { s/ ^ ([\w_-]+) \. ([\w:]+) CSS \. /$1.$2./x; say; } }
Can i extend  s/ ^ ([\w_-]+) \. ([\w:]+) CSS \. /$1.$2./x; subsitution of CSS to [A-Z]. ?

Replies are listed 'Best First'.
Re^3: Perl file name parsing - Regular expression
by Laurent_R (Canon) on May 30, 2017 at 08:20 UTC
    Yes you can, but you need to add a quantifier. For example:
    s/ ^ ([\w_-]+) \. ([\w:]+) [A-Z]{3} \. /$1.$2./x;
    or possibly:
    s/ ^ ([\w_-]+) \. ([\w:]+) [A-Z]+ \. /$1.$2./x;
    But you might have to watch out that [A-Z]+ will not match some other uppercase letter(s) before in some other file names.