Hello All!
I need something that will allow me to replace each space character with but only when the amount of space characters is greater than (or equal to) 2.
For example:
Would become this.
Code:
This had 5 spaces
I thought of using regex, like below, but it doesn't allow me to match each space character. I don't know of a way to "count" the amount of matched characters.
PHP Code:
preg_replace("/[ ]{2,}/", " ", $string)
Any help is appreciated!
Edit: Sorry, I only mean space. As in, " ".