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


Posted on 16th Feb 2014 07:03 pm 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

No comments posted yet

Your Answer:

Login to answer
255 Like 38 Dislike
Previous forums Next forums
Other forums

is this the proper use of mysql_real_escape_string() to prevent sql injections?
i was wondering is this the proper use of mysql_real_escape_string() to prevent sql injections? any

Secure pages Sessions vs. Cookies & session_destroy() help
Im new here and new to PHP, I hope you can help me with some questions.

Im writing my web ap

FFmpeg Images 2 Video conversion problem ??
I got folder full of images , number of images = 600 , I want to make a video which plays one image

for loop without same $i digits?
Hi,

Can some guru please advise how can I accomplish this with a simple for loop ?

I

Simple MySQL query...
Hello,
How could I do a mysql query that does this: SELECT * WHERE date/time < 5minutes ag

How do I use a global footer..?
If my index.php has a bole bunch of if functions and exit's in them

Where is my php.ini???
Hi

First off - apologies - i'm not a coder so this may sound very amateur.

I'm having

Sharing PHP Sessions Across Domains
I am in the process of writing a script to share a php session across various domains I have.
The

SWF image using php?
Hello once again.

My latest en devour requires me to produce an image of a static .swf that i

Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a ne

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash