If pattern is not valid it will not check the file for a match