javascript substring after last occurrence of character