I have a string:
services[custom][mainData]
How can I get the string mainData?
I have tried:
var result = id.match('\[(.*?)\]'); alert(result[1]); var result = id.match(\[(.*?)\]); alert(result[1]); To no avail. its simple for me to do with one set of brackets, the 2nd set is what throws me off.
/\[([^\]]*)\]$/should do it for you.