-3

How can I replace multiple (++++++) signs with blank space?

Example: var string = "+++++++++++++++++";

0

2 Answers 2

1

var string = "+++++++++++++++++";
string = string.replace(/\+*/g, '');
console.log(string.length);

Sign up to request clarification or add additional context in comments.

1 Comment

Hello there, I tried your code, the snippet you presented seems to work just fine. I am indeed grateful for your help!
0

const str = 'abc++++++def++++frberbf++fsvsf';
const newstr = str.replace(/(.)\+{2,}/g, ' ');
console.log(newstr);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.