$mystring = "Rescue21_binaries_V5.0.29.0_patch_R5.0.24.1_DiffList.txt"; if( $mystring =~ m/Rescue21\w_patch_\wDiffList.txt/ ) { }