Feel expression and extraction of its variables

Hi everybody,

I use feel-engine package in the 1.15.3 version from org.camunda.feel group and play around these guide Bootstrapping | FEEL-Scala and Java.

I evaluate/parse my feel expression by FeelEngine and I am impressed how easy is an evaluation of expressions. But here I met a challenge:

Simply feel expressions are provided by a user and names of used input variables could change as they refer to different data/fields from stored data.

Using Java, I need to extract these input variables names from a feel expression to know which data I should inject into them. I am wondering if there is an easy way to do that using classes from the feel-engine package. I tried to find any interesting method or api to get them but without success.

E.g. from the expression below

foo < 10 and boo in ("a", "b")

I would like to extract a list of 2 strings: foo, boo
Is this possible somehow?

Best,
Oskar

Oskar,

I have a similar scenario. Did you find the solution to this problem ?

Does anyone have the solution to Oskar issue above? I have similar issue to handle.

Hi, unfortunately I did not find any simple way to do this in FeelEngine. In consideration with my team, we decided to always wrap the variable name into single quotation sign like:

`foo` < 10 and `boo` in ("a", "b")

Then I created a simple variable extractor wich uses java.util.regex.Pattern to extract all variable names.

FeelEngine uses single quotation sign in a case when you would like to provide a variable name with white spaces so it is a legal format.