You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by David S Taylor <da...@bluesunrise.com> on 2017/06/20 01:42:50 UTC
[jexl] - Jexl parser tree - retrieve variables from expression
JEXL question:
Is there a way to take an expression such as “(x + y) / z)” and get a parser tree or even just a list of the variables in the expression?
I would like to know what variables are in my expression, in the example above, I would want a list of x,y,z
Is that possible?
Thanks,
—
David
Re: [jexl] - Jexl parser tree - retrieve variables from expression
Posted by David S Taylor <da...@bluesunrise.com>.
Thanks Henri that was exactly what I needed!
> On Jun 20, 2017, at 1:51 AM, henrib <he...@apache.org> wrote:
>
> Hi David;
> Yes you can if you create a script.
> Have a look at
> http://commons.apache.org/proper/commons-jexl/apidocs/org/apache/commons/jexl3/JexlScript.html#getVariables
> .
> Many examples in
> https://github.com/apache/commons-jexl/blob/trunk/src/test/java/org/apache/commons/jexl3/VarTest.java
> Cheers.
>
>
>
> --
> View this message in context: http://apache-commons.680414.n4.nabble.com/jexl-Jexl-parser-tree-retrieve-variables-from-expression-tp4700492p4700496.html
> Sent from the Commons - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [jexl] - Jexl parser tree - retrieve variables from expression
Posted by henrib <he...@apache.org>.
Hi David;
Yes you can if you create a script.
Have a look at
http://commons.apache.org/proper/commons-jexl/apidocs/org/apache/commons/jexl3/JexlScript.html#getVariables
.
Many examples in
https://github.com/apache/commons-jexl/blob/trunk/src/test/java/org/apache/commons/jexl3/VarTest.java
Cheers.
--
View this message in context: http://apache-commons.680414.n4.nabble.com/jexl-Jexl-parser-tree-retrieve-variables-from-expression-tp4700492p4700496.html
Sent from the Commons - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org