jquery.collection.js
function (collection, settings, html, oldIndex, newIndex, oldKey, newKey) {
            var toReplace = new RegExp(pregQuote(settings.name_prefix + '[' + oldKey + ']'), 'g');
            var replaceWith = settings.name_prefix + '[' + newKey + ']';
            html = html.replace(toReplace, replaceWith);

            toReplace = new RegExp(pregQuote(collection.attr('id') + '_' + oldIndex), 'g');
            replaceWith = collection.attr('id') + '_' + newIndex;
            html = html.replace(toReplace, replaceWith);

            return html;
        }
function (collection, settings, html, oldIndex, newIndex, oldKey, newKey) {
            var toReplace = new RegExp(pregQuote(settings.name_prefix + '[' + oldKey + ']'), 'g');
            var replaceWith = settings.name_prefix + '[' + newKey + ']';
            html = html.replace(toReplace, replaceWith);

            toReplace = new RegExp(pregQuote(collection.attr('id') + '_' + oldIndex), 'g');
            replaceWith = collection.attr('id') + '_' + newIndex;
            html = html.replace(toReplace, replaceWith);

            return html;
        }
function ( collection , settings , html , oldIndex , newIndex , oldKey , newKey ) { var toReplace = new RegExp ( pregQuote ( settings . name_prefix + '[' + oldKey + ']' ) , 'g' ) ; var replaceWith = settings . name_prefix + '[' + newKey + ']' ; html = html . replace ( toReplace , replaceWith ) ; toReplace = new RegExp ( pregQuote ( collection . attr ( 'id' ) + '_' + oldIndex ) , 'g' ) ; replaceWith = collection . attr ( 'id' ) + '_' + newIndex ; html = html . replace ( toReplace , replaceWith ) ; return html ; }
same as above, but will replace element names and indexes in an html string instead of in a dom element.
same as above but will replace element names and indexes in an html string instead of in a dom element .