Reputation: 141
I want to delete *
characters if it is present in a string.
This is my code but it's not working.
String.replace(/*/g '')
Upvotes: 2
Views: 76
Reputation: 1163
You have to escape the special character *
with a backslash, as it has another meaning in a regex.
String.replace(/\*/g, '');
Upvotes: 5