Your index() solution does not do exactly what the regex solution does.
Thanks for bringing that up - I had intended to comment on it, but forgot. I think only tybalt89's regexp solution matches the last occurrence, due to its inclusion of a leading /.*/ in the pattern. The pattern in the original post and in my two regexp-based solutions will match the first occurrence, same as the index() solution.
In reply to Re^3: How to remove everything after last occurrence of a string?
by hv
in thread How to remove everything after last occurrence of a string?
by ovedpo15
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |