diff --git a/lib/jsonform.js b/lib/jsonform.js index 11b5e0e8..784e8cfa 100644 --- a/lib/jsonform.js +++ b/lib/jsonform.js @@ -1356,6 +1356,7 @@ jsonform.util.getObjKey = function (obj, key, ignoreArrays) { if ((innerobj === null) || (typeof innerobj !== "object")) return null; subkey = keyparts[i]; prop = subkey.replace(reArray, ''); + reArray.lastIndex = 0; arrayMatch = reArray.exec(subkey); if (arrayMatch) { while (true) { @@ -1410,6 +1411,7 @@ jsonform.util.setObjKey = function(obj,key,value) { for (var i = 0; i < keyparts.length-1; i++) { subkey = keyparts[i]; prop = subkey.replace(reArray, ''); + reArray.lastIndex = 0; arrayMatch = reArray.exec(subkey); if (arrayMatch) { // Subkey is part of an array @@ -1441,6 +1443,7 @@ jsonform.util.setObjKey = function(obj,key,value) { // Set the final value subkey = keyparts[keyparts.length - 1]; prop = subkey.replace(reArray, ''); + reArray.lastIndex = 0; arrayMatch = reArray.exec(subkey); if (arrayMatch) { while (true) {