$ 0 0 Efficient, compact and works in the general case:s='sometext-20202's.slice(s.lastIndexOf('-')+1)