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

Αρχική Σελίδα
Delete this message
Συντάκτης: Zack Weinberg
Ημερομηνία:  
Προς: pcre-dev
Αντικείμενο: [pcre-dev] Feature suggestion: combine N compiled expressions
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).

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.

Thanks,
zw