You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by "B. Li" <cs...@126.com> on 2019/09/20 08:21:03 UTC

a question about REGEXP

Hi All,


I have a question about REGEXP. I would like to extract a digit (e.g. the third one) in a number (NUM). Could I use REGEXP to get the result of a matched group (something like NUM{REGEXP("^\\d\\d(\\d)")})?


Any hint would be greatly appreciated! Thanks in advance!


Baoli




Re: a question about REGEXP

Posted by Peter Klügl <pe...@averbis.com>.
Hi,


the REGEXP condition is only a boolean function without "side effects".


You could solve your use case in Ruta with simple regex rules. You need
to use some rules which do not depend on annotations for matching in
order to create smaller annotations. Something like:

DECLARE ThirdDigitInNum;

NUM -> {"^\\d\\d(\\d)" -> 1 = ThirdDigitInNum;};


Best,


Peter

Am 20.09.2019 um 10:21 schrieb B. Li:
> Hi All,
>
>
> I have a question about REGEXP. I would like to extract a digit (e.g. the third one) in a number (NUM). Could I use REGEXP to get the result of a matched group (something like NUM{REGEXP("^\\d\\d(\\d)")})?
>
>
> Any hint would be greatly appreciated! Thanks in advance!
>
>
> Baoli
>
>
>
-- 
Dr. Peter Klügl
R&D Text Mining/Machine Learning

Averbis GmbH
Salzstr. 15
79098 Freiburg
Germany

Fon: +49 761 708 394 0
Fax: +49 761 708 394 10
Email: peter.kluegl@averbis.com
Web: https://averbis.com

Headquarters: Freiburg im Breisgau
Register Court: Amtsgericht Freiburg im Breisgau, HRB 701080
Managing Directors: Dr. med. Philipp Daumke, Dr. Kornél Markó