in reply to Re: A better regex
in thread A better regex
Why capture when you don't have to?
$zipfile =~ /(?:A|B)FILE_(\d+)/; $day = $1;
Or you can use a character class (since the strings are 1 char long).
$zipfile =~ /[AB]FILE_(\d+)/; $day = $1;
Of course, you could always use the uber-sexy:
($day) = $zipfile =~ /[AB]FILE_(\d+)/;
;-P
Anonymously yours,
Anonymous Nun
|
|---|