Extract a string in the given range (e.g. from line X to line Y).