I think I know what you are saying, but my mental block is with how to get the four lines in the first place. Since these lines are being read one at a time from a file, how would I know when to read more than one? Are you suggesting that I read the whole file in to a single string and do substitutions on the whole thing?