only compare prefix of pattern