Hi! Welcome!
I think you will be most successful at getting help here if you provide more information about your problem. Without some sort of example, it’s very hard for others to understand what you’re trying to do and figure out how to help.
Ideally, you'd give us a fully reproducible example as a starting point. At the very least, can you show us the code that you have been trying to use, even if it doesn’t work? It will also be important to explain where your “whole text” comes from, and give us some sort of sample (or a link to a file).