[TRE-general] Match Description
Ville Laurikari
ville at laurikari.net
Tue Jun 12 15:08:15 EEST 2007
On Mon, Jun 11, 2007 at 03:35:08PM -0300, Arliones Hoeller Jr wrote:
>
> Hi everyone,
>
> I'm using TRE to search texts for multiple regex at the same time. My
> problem is that I would like to know which one of my regexs generated each
> match. Is it possible to have this information from the TRE?
It sure is. I presume your regex has this general form:
re1|re2|re3|re4|...
If you change it to
(re1)|(re2)|(re3)|(re4)|...
then you can use the submatch data reported in the pmatch[] array to
see which part matched. The rm_so and rm_eo fields are all -1 for all
but the part which matches.
If you need more details, try http://laurikari.net/tre/api.html.
If you're looking for very high performance, for something like this
I'd suggest you use a lexer tool instead (such as flex:
http://flex.sourceforge.net).
--
http://www.iki.fi/vl/
More information about the TRE-general
mailing list