I have below string pattern like Below.
"XX0XX XX7XX XX11XX XX26XX XX30XX XX38XX XX45XX **3** 10.1, Belkin Keyboard Folio"
I have to replace last "3" with "XX49XX" which does not have prefix and suffix with "XX"
I have done below code so far which is replacing first occurrence of 3 which is not correct
var string = 'XX0XX XX7XX XX11XX XX26XX XX30XX XX38XX XX45XX 3 10.1, Belkin Keyboard Folio';
str = string.replace(/3/, 'XX49XX');