I have those regex for ignore all style attribute. It works. But now I must show images inside html and don't remove style. I couldn't write regex in this case. Can you give any advice solve that problem. 

```
var test = "<a href='#' style='border:1px solid red;'>dasda</a><img style='border:1px solid red;' />";
var rex = /\s+style\s*=\s*(\"|\').*?(\"|\')/igm
str = test.replace(rex, '');

```

**EDIT**

I know how to use selectors. 'test' is not 'DOM' element. This operation works inside fully javascript . 'test' is just any text. on every occasion I check the text is simple text or not . if not maybe it html and if it is any html code I will clear that( as converting to simple string )