1. Divide a different meaning of #num parameter for different trigger functions.
2. Add new required feature. For instance - a regexp function for previous or N-th value (single value !).
1. Currently without an experience and without looking to documentation its not clear (IMO) what parameter #num means: number of values or N-th previous value.
For some trigger functions it's intuitively not hard to understand which is the meaning of #num.
For instance for the "max()" it's of course number of values, and for the "last()" it's of course N-th previous value.
But try to guess the meaning of the "#num" for the function regexp() or str() WITHOT looking to documentation. Not easy? Yes?
2. I would like to use regexp() function for for previous or Nth value (single value !) as I said at the start. How I can do that? Yes, at the moment - is no way.
Additional point of view - at the moment in the trigger expression we can "compare" with N-th historical value of NUMERICAL data using the last(#num) function but we cannot do the same for TEXT data. The function regexp(search,%2) would help to do that.
I would suggest leave to use hash mark # for the number of values.
And use new symbol % for N-th previous value.
In this case less count of functions will change type of used parameter, other functions will add support of "%num". For instance regexp() will support both #num and %num.
Functions which should use new parameter type %: last, strlen.
Functions which should additionally support new parameter type %: logeventid, logseverity, logsource, iregexp, regexp, str.
Currently: # - used, @ - global regexp, $ - macros. So it seems the mark % is free and could be suitable, but another ones could be used too (like ! or & or ^)