Reputation: 1372
I want a clean solution to replace dots in text:
Some title.... to this: Some title...
Some.... title...... to this: Some... title...
How can I replace every sequence of more than 3 dots with 3 dots?
Upvotes: 0
Views: 2487
Reputation: 57670
Its almost same as hakre. But more cleaner.
preg_replace('/\.\.\.+/', '...', $str);
Another repeated way (non-regex)
while(strpos($str, "....")!==false)
$str = str_replace("....", "...", $str);
Upvotes: 1