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

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -