From: George George Date: 2009-10-16T13:25:52+09:00 Subject: Re: matching against a zillion patterns Robert Klemme wrote: > 2009/10/15 George George : >> >> >> depending on which pattern the string contains. > Looks like this is tricky to become right. There seem to be some > people around that do bioinformatics, maybe some of them do have a > solution already. > > Things you could do off the top of my head: since it seems your > patterns are only strings you could optimize the pattern by building a > trie from it and then creating a RX from that. I've done this before > (see below). Advantage is that your regular expression gets smaller > and matching becomes more efficient (because of eliminated > backtracking for NDA based RX engines). Thank you so much Robert! I have tried your approach and compressed the patterns to a single regular expression. (removed backtracking). Seems like a parser solution approach may also help. e.g. the one that Josh had illustrated Thomas, I have looked at bioruby and I regulary use it and relatively know it quite well, but we dont have a solution that i am aware of. I might repost this on the bioruby list, together with a reference to this thread. Thank you so much. -- Posted via http://www.ruby-forum.com/.