generate right pattern
check pattern