$subject = "SPRINT-1.csv";
$pattern = '/^[a-zA-Z]\-[0-9]\.(csv)+$/';
if(preg_match($pattern, $subject)) {
echo "Match";
} else {
echo "NOPE";
}
or
$subject = "SPRINT-1.csv";
$pattern = '/^\w\-\.(csv)+$/';
if(preg_match($pattern, $subject)) {
echo "Match";
} else {
echo "NOPE";
}
A character class
[…]does only describe one single character. So[a-zA-Z]describes one character out ofa–z,A–Z. The same applies to\w(that’s also a character class).You forgot to describe the quantity the characters from that character classes may appear, like:
?: zero or one repetition*: zero or more repetitions+: one or more repetitions