How do I replace any number of character occurences with one occurrence?

Posted on 16th Feb 2014 by admin

How do I replace any number of character occurences with one occurrence?

Let's say I have:

aaa
aaaaaa
aaaaa
aaaaaaaa

All of the above should be replaces with a single 'z' character say for example

I can do exact matches, say for 'aaaaaa' - but am unsure how I can do for any number

I'm sure it should be possible to do using one line of code - but I'm just not sure where to start!

Thanks

Other forums