@tests = qw[ 10-K 10-KSB 10-K405 10-KSB405 10-Q 10-K/B 10-KSB/ABC 10-K405/A 10-KSB405/A 10-Q/A];; printf "%s : %s\n", $_, $_ =~ m[10-[KQ][^/]*$] ? 'matches.' : 'does not match.' for @tests;; 10-K : matches. 10-KSB : matches. 10-K405 : matches. 10-KSB405 : matches. 10-Q : matches. 10-K/B : does not match. 10-KSB/ABC : does not match. 10-K405/A : does not match. 10-KSB405/A : does not match. 10-Q/A : does not match.