regex - javascript replace last occurrence of string -


i've read many q&as in stackoverflow , i'm still having hard time getting regex. have string 12_13_12.

how can replace last occurrence of 12 with, aa.

final result should 12_13_aa.

i explanation how did it.

newstring = oldstring.substring(0,oldstring.lastindexof("_")) + 'aa'; 

Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -