Here I have an example of a piece of literature that I would like to do a simple analysis on. Notice the different sections:
str = "Random info - at beginning-man. "+ ...
"Random info still continues. "+ ...
"CHAPTER 1. " + ...
"Random info in middle one, "+ ...
"Random info still continues. "+ ...
"1 This is sentence one of verse one, "+ ...
"This still sentence one of verse one. "+ ...
"2 This is sentence one of verse two. "+ ...
"This is sentence two of verse two. "+ ...
"3 This is sentence one of verse three; "+ ...
"this still sentence one of verse three. "+ ...
"CHAPTER 2. " + ...
"Random info in middle two. "+ ...
"Random info still continues. "+ ...
"1 This is sentence four? "+ ...
"2 This is sentence five, "+ ...
"3 this still sentence five but verse three!"+ ...
"Random info at end's end."+ ...
"Random info still continues. ";
I'm interested all the data dat can be called "Random info in middle", which is after a Chapter name, and before a verse beginning.
I would like to use the function "extractBetween" to extract the information found between "CHAPTER #" and "1"(First Verse).
I know how to use the function "extractBetween", but how can I determine the locations just before "CHAPTER #" and just after "1"(First Verse), for any amount of Chapters?
At the end I would like to have such an answer, where the random information for each Chapter is allocated in a table:
I've tried, regexp() and findstr(), but have no success.
All help will be appreciated. Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…