check input pattern