I have a string as follows:
var str = 'Array
(
[shopUsername] => tod
[password] => 12345678
[shopID] => 19
)';
I'm trying to parse this in JavaScript using the following regular expression:
var matches = parsedXMLStr.match(/\[(.*)\]/g);
which returns each of the key values as [ '[shopUserName]', '[password]', '[shopID]' ]
.
How do I change the regular expression to strip out the square brackets from the returned values, i.e. the array should be ['shopUserName', 'password','shopID']
.