user1477955
user1477955

Reputation: 1670

Replace nbsp; and HTML tags with empty space

I want to get rid of HTML tags and nbsp; How can I combine these operations?

JS

 .replace(/&nbsp;/g,'').replace(/(<([^>]+)>)/ig,"")

Upvotes: 0

Views: 1929

Answers (1)

adeneo
adeneo

Reputation: 318342

Just join them together

.replace(/(&nbsp;|(<([^>]+)>))/ig,'');

Upvotes: 6

Related Questions