(* how to transform "abc2" into "abc3" ? *)
string = "abc2"; regex = ".$"; newString = StringReplace[string, RegularExpression[regex] -> IntegerString[1+$0 ]]
(* output expected: "abc3" - but output is:
"abc"~~IntegerString[1+$0]
*)
(* solved:
:> not -> ,the latter,Rule,is evaluated immediately *)
string = "abc2";
regex = ".$";
newString = StringReplace[string, RegularExpression[regex] :> ToString[1 + FromDigits["$0"]]]
(* output is: "abc3" *)