-1

Here is my string

string str = "++10+++10++++10";

and I have tried this regex

str.replace(/(\+\+||\+\+\+||\+\+\+\+)/g, '+');

how to replace these plus are in one plus like '+10+10+10'.help me.

4

1 回答 1

1

单程:

"++10+++10++++10".replace(/\++/g, "+")
于 2016-05-05T10:59:50.070 回答