var str = "user=true;auth=openid;location.href='https://vk.com/auth/jDHSHjk=089&jhGAJ99aU-_83jhASIhdisajoidsa'"; var result = /'([^']+)/.exec(str)[1]; alert(result);