in reply to Hlelp regarding regex

Not quite sure exactly what you are looking for, but something like this might serve:

>perl -wMstrict -le "my $x = '\\files\builds\data\M9998SBQCACSYD30401S'; ;; if ($x =~ m{ (Y [[:alpha:]] \d) }xms) { print qq{match: '$1'}; } " match: 'YD3'