I\'m trying to replace the last dot in a String using a regular expression.
Let\'s say I have the following String:
String string = \"hello.world.how
The regex you need is \\.(?=[^.]*$). the ?= is a lookahead assertion
\\.(?=[^.]*$)
?=
"hello.world.how.are.you!".replace("\\.(?=[^.]*$)", "!")