Szerző: Jacob Rief Dátum: Címzett: pcre-dev Tárgy: [pcre-dev] How to iterate over the compiled regular expression tree?
Hello,
I would like to use pcre in an application, where additionally to the
text to parse, I have an n-gram index of that text. It would be
beneficial, if I could extract the plain strings from a regular
expression, and use them as keys for that index.
Example: During compilation of the regular expression "abc.+xyz" the
strings "abc" and "xyz" are extracted. They could be used as keys for
the index, narrowing the amount of text to be parsed. My idea was to
access the compiled struct pcre, iterate over the extracted regex
components, and look for a table containing the plain strings "abc"
and "xyz"
pcre* re = pcre_compile("abc.+xyz", 0, &error, &erroffset, NULL);
Note that gdb automatically uses 'struct real_pcre' to display the
content of 're'.
But there is no tree and no anchor to anything looking like a tree.
How can 'struct real_pcre' store anything like a compiled version of
my regex? Is there a way to access that content?