I'm trying to filter publicly submitted content with PHP to prevent folks from adding too many periods to the end of their content.
Submitted content might be in the form of this html:
<p>Hi Jummy. I haz the lolz...............</p>
<h3>Yeah.... <a href="/foo">dem lolz are funny</a>..</h3>
Ideally, I'd like to replace the instances of excessive periods with the following rules
1 period = left alone
2 periods = 1 period
2+ periods = …
So the above example would become:
<p>Hi Jummy. I haz the lolz…</p>
<h3>Yeah… <a href="/foo">dem lolz are funny</a>.</h3>
Many thanks