How to insert a special tag/text?

Hi all,
I want to insert a special tag/text for every 1000 words in a long text information say 10,000 words totally…
means i want to insert that special tag/text in this text information is 10 times.

How to dynamically insert the tag/text into the text for each 1000 words.?

Thanking you in advance…

Don’t know exactly what you mean by special text, but the simplest method that comes to my mind:

preg_replace('/(?:[^\\s]+\\s+){1000}/', '$0-special-text-here-', $str);

Thank you for your reply.
it is not working properly.

Special text means some keyword;
It is inserting at last occurrence of 1000 words, but not the before one’s.?

Not sure, I tested that regex before I posted it here. It should work as far as I can figure.