How to remove all or some attributes from a node

remove node

Sometimes you need to remove all or some attributes from a node, and have to be done by javascript. This script will allow you to remove all attributes from a node, or the once that match with your regex pattern sent as a parameter.

Here is the magic.