[comp.lang.icon] reverse match

dscargo@CIM-VAX.HONEYWELL.COM ("DAVE CARGO") (11/18/89)

I found myself writing a application where I wanted to make a decision
based on characters at the END of a string.  I wanted something like match
but working from the end rather than the beginning of the string.  What I
chose by way of implementation was the following:

nekot := reverse(token)
if match("." | ")." | "\"." | ")\".", nekot) ...

I have two questions.  In general is there a better way to do this?  The
strings I wanted to test for are different sizes so a fixed range didn't work.
Second, could I have used

if match("." | ")." | "\"." | ")\".", reverse(token))

directly without having the reverse(...) evaluated multiple times?  (An
admittedly lazy question on my part, since I could have tested this.)

David S. Cargo (DSCARGO@CIM-VAX.HONEYWELL.COM)