use detect of pattern