I need plugin to get text value 400 characters above the cursor position in Rich Text Editor

I need to get the values of the rich text editor (400 characters) above the cursor position

Any advice to achieve this?

I tried splitting text like this

This will get the values I want, the problem is that I need to insert Pipe symbol manually.

Any chance split automatically on cursor position?

Thank you very much!