On Tue, 25 Aug 2020, Giovanni Bechis wrote:

On 8/25/20 7:11 PM, John Hardin wrote:
Does anybody know of a command-line (NOT interactive!) tool that will generate a minimal 
"or" RE from a list of terms?

For example, given input like:

    17118720
    17159892
    17179275
    17180740
    17182828

...it would generate:

    (?:171(?:18720|59892|79275|8(?:0740|2828)))

I don't want to reinvent the wheel... :)

you can start from this perl one-liner:
https://cwiki.apache.org/confluence/display/SPAMASSASSIN/BayesStopList

Thanks, Regexp::Trie does that quite well.

--
 John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
 [email protected]                         pgpk -a [email protected]
 key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
  Gun Control is marketed to the public using the appealing delusion
  that violent criminals will obey the law.
-----------------------------------------------------------------------
 Today: the 1941st anniversary of the destruction of Pompeii

Reply via email to