regex - What is the lib/algorithm for matching multiple regular expression against a single target string in C? -


i want match multiple regular expressions against single string & stop when first regular expression matches.

i exploring few solutions here http://sljit.sourceforge.net/regex_perf.html

but none of them seem take consideration match of multiple regular expression against single string.

is there solution speed up?

you use alternation. is, if you're looking expressions \a+b\ , \[a-z0-9]+xyz\, write single regular expression grouping: \(a+b)|([a-z0-9]+xyz)\. regex engine return first match finds.

the unix fgrep tool you're looking for. if give list of expressions find, find occurrences in single scan of file. dr. dobb's journal published article it, c source, sometime in late '80s. quick search reveals article called parallel pattern matching , fgrep, ian ashdown. didn't find source, didn't hard. given little time, might have more luck.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -