optimization for wildard at start or end