I'm trying to write a regular expression to replace first among repeated characters in a string.
The catch is the repeated characters can also be non-consequent.
Ex:
Input: abcdebg
Replace by character: x
Expected Output: axcdebg
I have been trying to do this with a regular expression: (.).*(\\1)
But the result when i do a replace is: axg
Please suggest how i can achieve the expected result.
Thanks,
Sash
axcdexg?