in reply to Re^2: Hlelp regarding regex
in thread Hlelp regarding regex

$x should match the pattern Y(digit)(number)
Surely you mean Y(letter)(number)?

Try this:

$x =~ /Y[A-Z]\d+[^\d\\]*$/
as in
for my $x ("\\\\files\\builds\\data\\M9998SBQCACSYD30401S", "\\\\file +s\\builds\\data\\M9998SBQCACSAD30401S") { if($x =~ /Y[A-Z]\d+[^\d\\]*$/) { print "$x matches\n"; } else { print "$x doesn't match\n"; } }
which yields:
\\files\builds\data\M9998SBQCACSYD30401S matches \\files\builds\data\M9998SBQCACSAD30401S doesn't match

([^\d\\] makes sure you matched the last number, and no backslash follows.)