in reply to select line from file

Yes, a regexp could be an approach this problem. So could split.

Searching the monastery on these topics would be fruitful also.

This sounds a lot like homework. You'll find you get more specific answers when you demonstrate you've actually tried writing some code and ask specific questions about specific problems you've encountered.