How would I search for a specific string that appears between two other specific strings? For example, given the following text I want the number that the first "ghi" refers to, so I need to find the "ghi" that comes after "abc" but before "pqr". I want to make sure I get the 789 instead of the 234.
abc123
def456
ghi789
jkl012
mno345
pqr678
def901
ghi234
jkl567
abc123
def456
ghi789
jkl012
mno345
pqr678
def901
ghi234
jkl567