I have the following input name:
fw_options[testgradient][background-gradient-start-color]
I need to get the last part of the name:
background-gradient-start-color
I was able to do this with this messy code:
name.replace('][','-').replace(/^[^-]*-/,'').replace(']','').replace('[','');
However, I forgot that the name can also look like this:
fw_options[header_boxstyle][background][background-gradient-start-color]
So, I ended up with the wrong string:
backgroundbackground-gradient-start-color
Can someone please simplify this for me, so that I don't have to use multiple replaces?
I need to get the last part without matching background-gradient-start-color literally, since I have multiple names that I need to find with the same regex.