Find out which words in a large list occur in a small string

后端 未结 3 924
暖寄归人
暖寄归人 2021-01-19 16:47

I have a static \'large\' list of words, about 300-500 words, called \'list1\'

given a relatively short string str of about 40 words, what is the fastes

3条回答
  •  长发绾君心
    2021-01-19 16:55

    For faster regular expressions, use https://github.com/mudge/re2. It is a ruby wrapper for Google re2 https://code.google.com/p/re2/

提交回复
热议问题