4 ms·
I'm not aware of any tools out of the box, but you could trivially build your example regex from a Trie which is also easy to construct. https://en.wikipedia.o
by julian37 10y ago
I'm not aware of any tools out of the box, but you could trivially build your example regex from a Trie which is also easy to construct.
https://en.wikipedia.org/wiki/Trie#Algorithms https://en.wikipedia.org/wiki/Trie#Algorithms
I'm not so sure it would take up much less space though, if you take gzip compression into account. See for example here:
https://github.com/google/closure-compiler/wiki/FAQ#closure-compiler-inlined-all-my-strings-which-made-my-code-size-bigger-why-did-it-do-that https://github.com/google/closure-compiler/wiki/FAQ#closure-...
- ybx 10y agoSomething like that would probably be better off with Aho-Corasick, with is similar to a trie but ends up with more compact FSMs
- Klathmon 10y agoHmm I've never heard of tries before but that looks pretty close to what I'm looking for. As for the size aspect, it might not make much of a difference in the gzipped filesize but there are other benefits to smaller raw source as well (but honestly I don't have any idea if it would be at all worth anything, I'm assuming no).