Auteur: Ronen Hod Date: À: pcre-dev@exim.org Sujet: [pcre-dev] What is the best way to multi match
Hi,
I am parsing an HTTP query-string ("s1&s2&...&sn"), and need to find which of the patterns (p1, p2, ..., pm) exist there.
So far the best way that I found was to use the RegExp
^(|.+&)p1($|&)(?C0)|^(|.+&)p2($|&)(?C0)|...|^(|.+&)pm($|&)(?C0)
and remember the position of every "|" that follows the callout so I can identify them when I get the callout (using pcre_dfa_exec()).
Does anybody have any better working solution for this problem?
Comments:
1. I always use (?C0) because the callout number is limited to 255.
2. I start all of them with a "^" because all of the returned matches have to start from the same place. Actually, this is the part that bothers me the most.