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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

RegEx help 3
regex help 1
regex -- substitute chars outside quoted strings 5
RegEx Help - particular anchors 2
Regular Expression help C# 3
Regex with quotes 6
Insert character using Regex 4
OT: RegEx Help 1

Back
Top