#!/usr/bin/perl $file= "SYSB_A31.GROUPINS%RDEBLIST%REAPPLY%2008.12.16.20.31.35.pdf"; if ($file=~ /^SYS(?:[^%]+%)+[^.]*\.pdf/i){ print "yes"; } else{ print "no"; }