I have a string that holds sub-strings enclosed in starting and closing brackets. For example:
"We want to visit that place (HBD) and meet our friends (DTO) after a long time. We really love having such gatherings at this time of year (XYZ). Let's do it."
I want to replace each pair of starting and closing brackets with a string containing a number that is increasing after every encounter of pair of brackets. Like it should be:
"We want to visit that place sb1-HBD-eb1 and meet our friends sb2-DTO-eb2 after a long time. We really love having such gatherings at this time of year sb3-XYZ-eb3. Let's do it."
If anyone can help me to provide some regular expression way to solve this problem. Thank you.