Sacha Chua has a problem. From an Org file, she’d like to link to and possibly include a set of consecutive lines in another (or, I suppose, the same) file. The problem is that the target file may not be static so using line numbers, which are subject to change, doesn’t work.
Her solution is to define a custom link that includes two regular expressions. That way, she can link to and include the lines between the two regexps. Check out her post for an example and a few more details.
Most of Sacha’s post is the code that defines the new link type and that, of course, is worth studying just to see how one goes about doing that even if you aren’t interested in the problem Sacha’s solving. Like all of Sacha’s posts, it’s definitely worth taking a look at.