Reputation: 15048
I got the following string in UTF-8 encoding:
€ ;64.95
The "€" represents a Euro currency sign. I want to write code that erases all UTF-8 characters that are not '.' and/or a digit. Do you know how to do it?
Upvotes: 0
Views: 27
Reputation: 23492
You are scraping HTML and what you have posted is an example of an escaped character for use in HTML. If you are not interested in unescaping this character, but just removing it, then something as simple as the following should suffice.
const str = '€64.95';
const after = str.replace(/&#\d*;/gm, '');
console.log(after);
Upvotes: 1