implemented code to find instances based on extraction patterns