added a function for copying found matches to a register