.INSTRR

.INSTRR (spos, string, pattern)

.INSTRR() is similar to INSTR() except it searches in reverse—e.g. it searches the string for the pattern, starting at the specified spos and working backwards towards the beginning of the string. The return value is the position of the last match—i.e. first match working backwards, with 1 indicating the first character of the string and 0 indicating no match.

Unlike INSTR(), .INSTRR() supports both positive and negative starting positions, with negative values counting from the end of the string—e.g. -1 starts the search at the end of the string. However the return value is always >= 0—i.e. position starting from the beginning of the string.

Also unlike INSTR(), .INSTRR() does not support the 4th argument used for regular expression searches.

See Also

•   INSTR()

•   NFIND.SBR

History

2016 September, A-Shell 6.3.1527:  Function added to A-Shell.