Is there a way to scrape data from a website until 'X' string is found?

Hello @tsielk ,

Consider this string as an input,

String sampletext=“As they rounded a bend in the path that ran beside the river, Lara recognized the silhouette of a fig tree atop a nearby hill. The weather was hot and the days were long. The fig tree was in full leaf, but not yet bearing fruit.
Soon Lara spotted other landmarks—an outcropping of limestone beside the path that had a silhouette like a man’s face, a marshy spot beside the river where the waterfowl were easily startled, a tall tree that looked like a man with his arms upraised. They were drawing near to the place where there was an island in the river. The island was a good spot to make camp. They would sleep on the island tonight.”

now you want the ending index number which can be get by using LastIndex = sampletext.Index(“tonight”)
and text until “1500s” by using requiredindex = sampletext.Index(“1500s”) we can get the index number of 1500s text.

now keep “requiredindex” in “LastIndex” you can get the required text.

you can refer to the following links,

cheers @tsielk