Path: utzoo!utgpu!watmath!att!rutgers!usc!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!CIM-VAX.HONEYWELL.COM!dscargo From: dscargo@CIM-VAX.HONEYWELL.COM ("DAVE CARGO") Newsgroups: comp.lang.icon Subject: reverse match Message-ID: <8911201630.AA01326@megaron.arizona.edu> Date: 17 Nov 89 22:53:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 18 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)