5

How to reverse-match a string in the Vim programming language?

view full story
linux-howto

http://unix.stackexchange.com – I want to find the last index of any character in the [abc] set in the abcabc string but the search should start from the end of the string: " Returns the 0th index but I want the 3rd. let a=match('abcabc', '[abc]') I skimmed through Vim's "4. Builtin Functions" (:h functions) but the only method that looked promising,the reverse method, only operates on lists. A limitation I don't understand because functions like len were designed to work even with strings, numbers, and lists. To solve the problem I came up with my following function: function! s:rvrs(str) let a=len(a:str) le (HowTos)