in reply to pattern finding algorithm

Given the sample data in question, I'm going to hazard a guess that you might want to look at bioperl and see if there's not something off the shelf that does what you're looking for.