RegEx help

  • Thread starter Thread starter AWHK
  • Start date Start date
A

AWHK

I need to replace double (or more) characters in a string with a single
character, ie. "coding is funny and I am feeling ill." becomes "coding is
funy and I am feling il". The expression must also handle ie. "funnny" that
should become "funy". Can this be done with regular expression? Where do I
start?

andreas.w.h.k. :-)
 
AWHK said:
I need to replace double (or more) characters in a string with a single
character, ie. "coding is funny and I am feeling ill." becomes "coding is
funy and I am feling il". The expression must also handle ie. "funnny"
that should become "funy". Can this be done with regular expression?
Where do I start?

Just replace

(?<char>.)\k<char>+

with

${char}


Oliver Sturm
 
Back
Top