I want to remove all occurrences of substring = . in a string except the last one.
.
E.G:
1.2.3.4
should become:
123.4
You can use regex with positive look ahead,
"1.2.3.4".replace(/[.](?=.*[.])/g, "");
1.4m articles
1.4m replys
5 comments
57.0k users