Re: [pcre-dev] Feature suggestion: combine N compiled expres…

Αρχική Σελίδα
Delete this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Zack Weinberg
Υ/ο: pcre-dev
Αντικείμενο: Re: [pcre-dev] Feature suggestion: combine N compiled expressions
On Thu, 25 Oct 2007, Zack Weinberg wrote:

> I'm wondering how hard it would be to add a function to the PCRE
> library that took an array of compiled regexps and combined them all
> into one regexp, either by concatenation (abc) or alternation (a|b|c).


Probably possible, but not totally straightforward (off the top of my
head).

> My use for this is a file full of user-written regexps, whose ultimate
> use is in a boolean "did any of these match this string?" decision -
> so I currently have it coded to read the whole file and concatenate it
> into one big long string with | between lines, then feed it to
> pcre_compile2() all in one go. This makes it difficult to give good
> diagnostics if there is a syntax error in a pattern. If I could
> compile them all separately and then combine them afterward it would
> be easier.


I must be missing something. What is wrong with a loop that compiles and
executes each one separately?

Philip

--
Philip Hazel