If 2 patterns match at the same offset like below example, then there will be 2 match
callbacks happening in Hyperscan - one for pattern0 and the other one for pattern1.
We don't deliver these callbacks inside Hyperscan in any specific order like least
specific pattern to more specific ones you mentioned and can't predict or define the
order by ourselves.
Whether callback for pattern0 is delivered before or after that of pattern1 is mainly
related to the database generated by hyperscan compiler.
Thanks,
Xiang
-----Original Message-----
From: Hyperscan [mailto:hyperscan-bounces@lists.01.org] On Behalf Of Dmitry Kozlyuk
Sent: Thursday, April 19, 2018 8:06 PM
To: Hyperscan regular expression matching library <hyperscan(a)lists.01.org>
Subject: Re: [Hyperscan] Multi-pattern match order
Thank you, Xiang.
However, I'm still confused with simultaneous "arbitrary" and
"respectively" here:
Secondly, if there are patterns matching at the same offset, then the
triggering order of match callbacks is arbitrary.
i.e. Patterns
0: /[^c]*foobar/
1: /[^h]{10, 20}foobar/
Input: badgebrushfoobartest
If you define "HS_FLAG_SINGLEMATCH" for both pattern 0 and pattern 1, what
hyperscan will do is to trigger match callbacks for pattern 0 and pattern 1 respectively
at the first match offset, that is 16 in this case, and stop matching.
Could Hyperscan potentially first trigger callback for pattern 1, than for pattern 0
(still assuming a match at the same offset)? Empirically, it seems not to, but maybe
I'm missing something in my tests, and also you've said "arbitrary".
--
Dmitry Kozlyuk