How to check for a pettern in a given region?