christ59 so sorry for the long delay.
The function to get the first and last string works for textareas does not work in <div> or <p>.
At the moment I can not think of anything to solve this, I'm using a cell phone.
When I finish packing my mess I'll try to help. If you succeed please tell me how you did.