Subject: Re: bug#40868: Grep C library for multi-string pattern matching?

From: Shlomi Fish <[email-masked]>
Date: Mon, 27 Apr 2020 09:52:53 +0300

Hi Mr. Walton!

On Sun, 26 Apr 2020 09:58:10 -0400
Jeffrey Walton <[email-masked]> wrote:

> Hi Everyone,
> 
> I need to perform multi-string pattern matching in C. The problem I am
> working on does not allow a shell script. I'm looking for a library
> that implements Aho–Corasick or Commentz-Walter (or similar).
> 
> Does Grep provide a library that exposes its multi-string pattern
> matching? If not, can someone recommend an implementation?
> 

There is an impl of Aho-Corasik in C++ here:
https://www.geeksforgeeks.org/aho-corasick-algorithm-pattern-searching/ (under
CC-by-sa).

Furthermore, you may wish to look at FOSS grep-like tools:

* https://wiki.freebsd.org/BSDgrep

* https://github.com/ggreer/the_silver_searcher

* https://beyondgrep.com/more-tools/

> Thanks in advance.

-- 

Shlomi Fish       https://www.shlomifish.org/
Let’s talk about restores instead of backups - https://is.gd/WatQqu

“Stop reinventing wheels, start building space rockets.”
    — The motto of the Comprehensive Perl Archive Network

Please reply to list if it's a mailing list post - https://shlom.in/reply .