Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi, I find myself writting another app this month that requires matching against list of patterns, what I did the last time is:
This is straitghtforwad and it works. The problem is that it grows roughly N**2, (because there is relation between number of lines to parse, and amount of possible patterns). UPDATE: I keep patterns in hashref because the whole point of this excercise is to figure out WHICH regexp matched. ORing patterns together might be fine if I knew how to figure out which patter from such ORed pattern matched exactly. What do people do with such problems? Is it possible to optimise this? ( for example, group patterns into eee...groups based on common prefix or something common, or maybe preprocess those lines, split sentences into functional parts .. ) This seems like rather common task, are there any smart (or at least working) solutions? In reply to Matching against list of patterns by Eyck
|
|