client/splunk.ui.charting.js
function(fragment, reg, value) {
            if (typeof fragment == 'string') {
                if (fragment.match(reg)) {
                    fragment = fragment.replace(reg, value);
                }
                return fragment;
            }
            else if (typeof fragment == "function") {
                return fragment;
            }
            // watch out for infinite loops.  We make all changes to the array after iteration.

            var keysToRename = {};
            for (var key in fragment) {
                // recurse
                if (typeof fragment[key] == 'object') {
                    Splunk.util.replaceTokens(fragment[key], reg, value);
                }
                // we have hit a string value.
                else if (typeof fragment[key] == 'string' && fragment[key].match(reg)) {
                    fragment[key] = fragment[key].replace(reg, value);
                }
                // now that the value is changed we check the key itself
                if (key.match(reg)) {
                    // mark this to be changed after we're out of the iterator
                    keysToRename[key] = key.replace(reg, value);
                }
            }
            for (oldKey in keysToRename) {
                var newKey = keysToRename[oldKey];
                fragment[newKey] = fragment[oldKey];
                delete(fragment[oldKey]);
            }
            return fragment;
        }
function(fragment, reg, value) {
            if (typeof fragment == 'string') {
                if (fragment.match(reg)) {
                    fragment = fragment.replace(reg, value);
                }
                return fragment;
            }
            else if (typeof fragment == "function") {
                return fragment;
            }
            // watch out for infinite loops.  We make all changes to the array after iteration.

            var keysToRename = {};
            for (var key in fragment) {
                // recurse
                if (typeof fragment[key] == 'object') {
                    Splunk.util.replaceTokens(fragment[key], reg, value);
                }
                // we have hit a string value.
                else if (typeof fragment[key] == 'string' && fragment[key].match(reg)) {
                    fragment[key] = fragment[key].replace(reg, value);
                }
                // now that the value is changed we check the key itself
                if (key.match(reg)) {
                    // mark this to be changed after we're out of the iterator
                    keysToRename[key] = key.replace(reg, value);
                }
            }
            for (oldKey in keysToRename) {
                var newKey = keysToRename[oldKey];
                fragment[newKey] = fragment[oldKey];
                delete(fragment[oldKey]);
            }
            return fragment;
        }
function ( fragment , reg , value ) { if ( typeof fragment == 'string' ) { if ( fragment . match ( reg ) ) { fragment = fragment . replace ( reg , value ) ; } return fragment ; } else if ( typeof fragment == "function" ) { return fragment ; } // watch out for infinite loops.  We make all changes to the array after iteration. var keysToRename = { } ; for ( var key in fragment ) { // recurse if ( typeof fragment [ key ] == 'object' ) { Splunk . util . replaceTokens ( fragment [ key ] , reg , value ) ; } // we have hit a string value. else if ( typeof fragment [ key ] == 'string' && fragment [ key ] . match ( reg ) ) { fragment [ key ] = fragment [ key ] . replace ( reg , value ) ; } // now that the value is changed we check the key itself if ( key . match ( reg ) ) { // mark this to be changed after we're out of the iterator keysToRename [ key ] = key . replace ( reg , value ) ; } } for ( oldKey in keysToRename ) { var newKey = keysToRename [ oldKey ] ; fragment [ newKey ] = fragment [ oldKey ] ; delete ( fragment [ oldKey ] ) ; } return fragment ; }
walked through the entirety of fragment to all levels of nesting
and will replace all matches of the given single regex with the given
single value.
replacement will occur in both keys and values.
walked through the entirety of fragment to all levels of nesting and will replace all matches of the given single regex with the given single value . replacement will occur in both keys and values .