Safe regexs to clean serialized DOM?
问题 I'm after several, really safe regex patterns for JavaScript's .replace method. The input is a serialized DOM string, and I am wanting to remove all YUI3 classNames and YUI3 generated id attributes. var resourceDOMStr = Y.DataType.XML.format( Y.Node.getDOMNode(this.getIframeDOMContainer()).innerHTML ); alert('unsanitized markup:\n\n'+resourceDOMStr ); // Remove YUI-added id's and classes // regex to remove ' id="*"' // regex to remove entire class attr: ' class="'yui3-*'"' // regex to remove