Extract fields in DMN Decision tables

Hi,

I want to extract certain tokens from a string in my DMN Decision tables using Regex. I use FEEL-Scala currently as the language.

Input : Your penalty for Form 940
Expected Output : 940

In the above example, i want to extract any number which follows the word ‘Form’. Plz note that, the number can be any, so i cannot really use ‘contains’.
Can someone help how can i achieve this in DMN Decision tables.

Hi @Chenbaga_M_K,

You can use the string function extract()

1 Like

Hi @Chenbaga_M_K,

Below function extracts any sequence of digits of any length

extract("Your penalty for Form 940", "[0-9]*")

As per the docs, the result of extract function is a list of strings so the result of above example would be

["940"]

@hassang Thank you. I tried this even before and now again, but not sure why do i get “no function found with name ‘extract’ and 2 parameters”

This is how my expression looks like

extract(“penalty for Form 940 s”, “.Form (\d{3}).”)

The function extract() is not available yet. It will be added with the new version of the FEEL engine 1.14. (If you look at the docs for version 1.13 then you will not find this function.)

Until then, you could try to use the replace() function instead.

1 Like

Thank you @Philipp_Ossler