Efficient string matching algorithm

后端 未结 14 795
Happy的楠姐
Happy的楠姐 2020-12-16 07:13

I\'m trying to build an efficient string matching algorithm. This will execute in a high-volume environment, so performance is critical.

Here are my requirements:

14条回答
  •  囚心锁ツ
    2020-12-16 08:02

    you don't need regexp .. just reverse all the strings, get rid of '*', and put a flag to indicate partial match till this point passes.

    Somehow, a trie or suffix trie looks most appropriate.

    If the list of domains is known at compile time, you may look at tokenizing at '.' and using multiple gperf generated machines.

    Links: google for trie http://marknelson.us/1996/08/01/suffix-trees/

提交回复
热议问题