Read all the lines of a text file into an array if they match a certain pattern.