I need to replace a button using a Regex in JavaScript and was wondering how to do this. I know how to grab the src of the button, but I need to take the filename and either add some text "-next" or remove "-next", based on two options that can be toggled. Here are the two different file names:
/images/button.png
/images/button-next.png
Any help would be greatly appreciated.