Copy link to clipboard
Copied
I want to replace Double character to single character
Example
AA to A
BB to B
CC to C
DD to D
GG to G
So I use the parenthesis to find the character by group like (AA)|(BB)|(CC)|(DD)|(GG)
What i need to mention as a Change.
I tried with A$1,B$2,C$3,D$4
But is not working, I can undestand my method is wrong.
help me to find the right solution
Thankyou
Try using:
(\w)\1for your grep pattern. The trailing \1 is a back reference to the character captured in group 1 (in parentheses) so it matches two of the same character.
In your changeTo you can use $1 to refer to that same character.
Find: (\u)\1
Change: $1
You already have two correct answers, and here's another approach. A bit different, in theory a bit more efficient:
Find: (\w)(?=\1)
Replace: <leave blank>
It deletes a word character only if it's followed by its duplicate.
And here a forth and fifth ways to do it...
Find: (\u)\K\1
Replace: <leave blank>
Find: (?<=(\u))\1
Replace: <leave blank>
Copy link to clipboard
Copied
Try using:
(\w)\1for your grep pattern. The trailing \1 is a back reference to the character captured in group 1 (in parentheses) so it matches two of the same character.
In your changeTo you can use $1 to refer to that same character.
Copy link to clipboard
Copied
Find: (\u)\1
Change: $1
Copy link to clipboard
Copied
You already have two correct answers, and here's another approach. A bit different, in theory a bit more efficient:
Find: (\w)(?=\1)
Replace: <leave blank>
It deletes a word character only if it's followed by its duplicate.
Copy link to clipboard
Copied
And here a forth and fifth ways to do it...
Find: (\u)\K\1
Replace: <leave blank>
Find: (?<=(\u))\1
Replace: <leave blank>
Copy link to clipboard
Copied
Spoilt for choice!
Copy link to clipboard
Copied
Thankyou all for the right Answer.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more