var match = location.pathname.match(/staffel-(\d+)-episode-(\d+)/); if(match){ var staffel = match[1]; var episode = match[2]; }