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
Post a Comment