Manipulate rendered text from a full text field to insert own text before the third paragraph

This is a request from Portside in better showing share and subscribe options. A little intrusive but standard on news sites so we can make it part of the Drutopia News edition stack.

edit body text in hook_entity_view_alter drupal 9

edit body text in hook node view alter drupal 8

php get nth occurrence pos position