I need to replace every instance of ‘_’ with a space, and every instance of ‘#’ with nothing/empty.

var string = '#Please send_an_information_pack_to_the_following_address:';

I’ve tried this:

string.replace('#','').replace('_', ' ');

I don’t really like chaining commands like this. Is there another way to do it in one?

18 Answers
18

Leave a Reply

Your email address will not be published. Required fields are marked *