Returns the nth sub-expression value from the previous expression that was evaluated. If no argument is specified, then the value of the entire previous expression is returned (same as n=0).
This is similar to using %pat to return subpatterns, except that this works with any expression enclosed in parenthesis. Parenthesis are used to indicate sub-expressions.
The optional "level" argument can be used to specify the stack level to return results from. If omitted, the default value of 0 is used to access the current stack level. 1 would return subexpressions from the previous stack level, 2 from the stack level above that, etc. This can be used to fetch expressions within nested commands.
then the result would be "123 123". Where the first 123 is the result of the entire expression, and the second 123 is the @a subexpression. %exp(2) returns a null value because the (@b) subexpression was never evaluated (it didn't need to be evaluated because a True result was already obtained by the first subexpression)
Add comment