I have an regular expression which extract the last character of an string.
I have to convert the last character of the string as per condition. Condition : 0 --> { 1 --> A 2 --> B 3 --> C
Example
Input : 1001{ 10011 10012 10013
Output : 10010 1001A 1001B 1001C
I need to do this using regular expression, so what should be the regular expression to "find" the last character of the String and what should be the "replace" part of the regular expression.
The regex I was using to find the last character of a string is "\S(?!\S)"
.