Added function to extract fit error
Added switch to handle both greedy and exact pattern matches based on the sample name