This is my string: 50.00.00..00.00
50.00.00..00.00
I want to match all . except the last one, so after a replace I end up with 50000000.00
.
50000000.00
\.(?=.*\.)
Matches a dot (\.), which there must be another dot following it ((?=.*\.)).
\.
(?=.*\.)
(This assumes the regex engine supports lookahead, e.g. PCRE, Python, etc.)