use array for expanding patterns