In your case x/y :
var success = myString.split('/')[1]
You split the string into /, giving you ['x', 'y'] . Then you just need to target the second element (of course, a zero index).
Edit: for the more general case of "notWantedwanted":
var success = myString.replace(notWantedString, '');
Where notWantedString is equal to what you want to get rid of; in this particular case, "notWanted".
Zirak
source share