Regular expression generator/reducer?

后端 未结 8 1062
感情败类
感情败类 2020-12-04 20:01

I was posed an interesting question from a colleague for an operational pain point we currently have, and am curious if there\'s anything out there (utility/library/algorith

相关标签:
8条回答
  • 2020-12-04 21:01

    Today I was searching that. I didn't found it, so I create a tool: kemio.com.ar/tools/lst-trie-re.php

    You put a list on the right side, submit it, and get the regexp on the left one.

    I tried with a 6Kb list of words, and produced a regexp of 4Kb (that I put on a JS file) like: var re=new RegExp(/..../,"mib");

    Don't abuse of it, please.

    0 讨论(0)
  • 2020-12-04 21:08

    The Aho-Corasick matching algorithm constructs a finite automaton to match multiple strings. You could convert the automaton to its equivalent regex but it is simpler to use the automaton directly (this is what the algorithm does.)

    0 讨论(0)
提交回复
热议问题