How can I clean away 29% from the string below using Javascript?
This is a long string which is 29% of the others.
I need some kind of way to remove all percentage so the code must work with this string too:
This is a long string which is 22% of the others.
The regular expression
\d+%matches one or more digits followed by a%. That is then followed by an optional space so you don’t end up with two spaces in a row.Without the optional space at the end of the expression, you end up with