in reply to extract regions

We had basically this same question at parsing question. See some of the answers there (particularly the reference to bioperl).